How do I install programs?

kristofer
kristofer used Ask the Experts™
on
Hi, I'm a total Linux newbie (obviously).

How do I install programs when I only have the source code? I run Mandrake.

How do I see which programs are running? and how do I switch to them?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Commented:
Three questions at once, hm!

Question 1:
It depends on the source.  Perl and Python apps don't need to be built, because scripting languages like these run without the need to compile first.  If it's C source or similar, then you will need to run some installation scripts to compile and "make" the source code to an executable, and then install it in the right place.  For most apps this is not hard at all, you just run a couple of scripts, and all goes well.  Occasionally you will find the script will fail, and will give you some feedback on what you need to do to make it work: for instance, it wants a certain version of library installed first, that sort of thing.  An experienced programmer like you should find this pretty simple.

You can read how to do this here on the LDP site:
http://www.tldp.org/HOWTO/Software-Building-HOWTO.html

The Linux Documentation Project...
http://www.tldp.org/
...is full of HOWTO documents like this:
http://www.tldp.org/HOWTO/HOWTO-INDEX/categories.html
It's a great resource for people new to Linux.

Mandrake's Linux does provide easy-to-use installation tools, but these are for RPM packages, not source.  RPMs are a bit like Microsoft .MSI installable packages, typically with the pre-compiled executable all packed up with installation defaults and configuration info.

Another good resource for learning Linux tasks like these is the book "Running Linux" by Matt Welsh.  The new edition is out next month:
http://www.oreilly.com/catalog/runux4/

Question 2:
On Linux, as on any OS, there are "visible" programs, and programs running in the background.  To see a "snapshot" of all of the processes running on Linux, open up a command shell (like bash), and type at the prompt:
ps -ef

ps is the process snapshot tool.  The option "-e" shows all processes on the system, not just the ones running under your login ID.  The "-f" option gives a full listing of all the info about the processes.

Now ps is just a snapshot.  If you want to see a continuous list of all the processes, as well as how much CPU time and mem they're using, then use "top" at the command line, or the KDE version of top "ktop" (or "gtop" if you prefer Gnome).  This is a bit like the Windows Task Manager.  To quit the command-line version, press "q".

Question 3:
On the KDE and Gnome desktops, you can switch tasks with the taskbar, same as in Windows.  But at the command line, you can use "fg" to switch between.  For example, if you're looking at a manual file using "man", but want to switch over to editing a text file, you press ctrl-z to interrupt.  You'll now be back at the command line, with a "process stopped" notice, and a number, in this case 1.  You now have one processpaused in the background.  Now start the vi text editor.  Edit away, then press ctrl-z again (make sure you're not in vi's insert-mode first).  Now you see "process stopped" and the number 2 at the command prompt.  You've now got 2 process running in the background.  To switch back to the first paused process, type:
fg 1
..meaning "raise paused process 1 to the foreground" (fg).

Remember to kill your background process before exiting the shell.  Bash will not exit until you've done an fg to each process and killed it off, either gracefully (it's q for man, :q for vi).

HTH,

--
JF

Commented:
Oh yeah, I forgot to mention: if you want a list of what jobs you've got running in the the background, type:

jobs

For example:

[localhost]$ jobs
[1]- Stopped                 man vim
[2]+ Stopped                 vim

To bring a task back into the foreground type:
fg
...followed by the JOB_SPEC number, e.g. type:

fg 1
...to get man back in the foreground.

You can get the process ID as well if you type:

jobs -l
...for example:
[localhost]$ jobs -l
[1]- 3795 Stopped                 man vim
[2]+ 3810 Stopped                 vim

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial