Running Processes in the Background and Bringing To the Foreground
Novell Cool Solutions: Tip
By Scott M. Morris
Digg This -
Posted: 7 Nov 2005
- SUSE Linux 10
- SUSE Linux Professional
- Novell Linux Desktop
- SUSE Linux Enterprise Server
PROBLEM: How can I run a process in the background and then bring it to the foreground again?
SOLUTION: To run a process in the background, simply append a space and an ampersand (&) at the end of the commandline. At any time, you can then run the 'jobs' command. This shows you what processes have been run in the background. They are listed numerically. When you are ready to resume a process in the foreground, you type in 'fg %[INSERT PROCESS NUMBER HERE]'. You get the process number from the 'jobs' command we ran before.
As an example, let's try this with top. First, we run it in the background:
[scott@work:~]$ top &  11746 [scott@work:~]$
Next, let's take a look at the jobs we have running in the background:
[scott@work:~]$ jobs + Stopped top [scott@work:~]$
We can see that top has a  in front of it. We are going to use the '1' to bring that job back to the foreground:
[scott@work:~]$ fg %1
You will then see the output of top as you normally would expect.
Novell Cool Solutions (corporate web communities) are produced by WebWise Solutions. www.webwiseone.com