(Difference between pages)
imported>ThorstenStaerk |
imported>ThorstenStaerk |
Line 1: |
Line 1: |
− | bg, fg and jobs are [[process]] related [[commands]] that belong together. bg stands for background and fg stands for foreground.
| + | screenshot showing the default call of a program that goes into the foreground on the example of xclock |
− | | |
− | = Concept =
| |
− | When you start a [[program]] under Linux, by default the command runs in the foreground. This means the console is reserved for in- and output to and from this program. You do not get a prompt while the program is running. Here is an example for this showing the program xclock being called by the command
| |
− | xclock
| |
− | | |
− | [[File:Snapshot-fg-xclock.png]]
| |
− | | |
− | This program runs in the foreground, the console is reserved for its in- and output. To run the same program in the background, start it with the ampersand ("&") after the program name:
| |
− | xclock &
| |
− | | |
− | [[File:Snapshot-bg-xclock.png]]
| |
− | | |
− | In this case you can continue to call further [[commands]] on the console.
| |
− | | |
− | = Hints =
| |
− | Maybe you have started a program without the & behind it, and now you want to use console to issue further commands. In this case stop the program using CTRL_Z:
| |
− | tweedleburg:~ # xclock
| |
− | ^Z
| |
− | [1]+ Stopped xclock
| |
− | List it using the command jobs
| |
− | tweedleburg:~ # jobs
| |
− | [1]+ Stopped xclock
| |
− | And send it to the background using the command bg
| |
− | tweedleburg:~ # bg
| |
− | [1]+ xclock &
| |
− | tweedleburg:~ #
| |
− | Now it will be as if you had called the command with the & behind it. You will be able to use console for issueing further commands.
| |
− | | |
− | = See also =
| |
− | * [[disown]]
| |
− | * http://www.lehman.cuny.edu/cgi-bin/man-cgi?jobs+1
| |
− | | |
− | [[Category:Concept]]
| |
Revision as of 09:45, 16 December 2011
screenshot showing the default call of a program that goes into the foreground on the example of xclock