Running Processes in the Background and Bringing To the Foreground
Novell Cool Solutions: Tip
By Scott M. Morris
Reader Rating
from 1 ratings
|
Digg This -
Slashdot This
Posted: 7 Nov 2005 |
Applies to:
- 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:
[1100][scott@work:~]$ top & [1] 11746 [1100][scott@work:~]$ |
Next, let's take a look at the jobs we have running in the background:
[1100][scott@work:~]$ jobs [1]+ Stopped top [1102][scott@work:~]$ |
We can see that top has a [1] in front of it. We are going to use the '1' to bring that job back to the foreground:
[1102][scott@work:~]$ fg %1 |
You will then see the output of top as you normally would expect.
Reader Comments
- It would be good to know how to disown a process as I've had mixed results. This would be good from both a cron and command line perspective.
Novell Cool Solutions (corporate web communities) are produced by WebWise Solutions. www.webwiseone.com
