The following table lists the basic Unix/Linux job control commands:
Command | Explanation | Example |
---|---|---|
& |
Run the command in the background
|
% long_cmd & |
Ctrl-z |
Stop the foreground process | [Ctrl-z] Stopped |
jobs |
List background processes | % jobs [1] - Stopped vi [2] - big_job & |
%n |
Refers to the background number
n |
% fg %1 |
%?str |
Refers to the background job containing
str |
% fg %?ls |
bg |
Restart a stopped background process
|
% bg [2] big_job & |
fg |
Bring a background process to the foreground
|
% fg %1 |
kill |
Kill a process | % kill %2 |
~ Ctrl-z |
Suspend an
rlogin or ssh session |
host2>~[Ctrl-z] Stopped host1> |
~~ Ctrl-z |
Suspend a second level
rlogin or ssh session |
host3>~~[Ctrl-z] Stopped host2> |
This table is adapted from Essential System
Administration, by Aeleen Frisch, copyright 1995, O’Reilly & Associates, Inc.