Process and Job control

Important terms

  • PID: process identifier.
  • job-ID: job identifier.

Listing process and jobs

Command Effect
ps Displays a list of processes and corresponding PIDs.
ps gx Displays a list of processes, including “hidden” processes, and corresponding PIDs.
jobs Displays a list of current jobs and corresponding job-IDs.

Stopping (suspending) a job/process

To stop (suspend) a job/process, type Ctrl-Z. The suspended process will still be listed in the list of active processes even though it has been suspended.

Running a job in the background

Command Effect
mozilla & Launches Mozilla as a background process (note the ampersand).
The browser window will still appear; however, your shell will continue to accept commands.

Suspending a process will also run that process in the background. Here's an example:

UNIX> mozilla
(Ctrl-Z pressed here)
  [1]+  Stopped
UNIX> bg

The first command launches Mozilla. Pressing Ctrl-Z suspends Mozilla. Running the bg command resumes Mozilla, but begins running it in the background.

Bringing a job to the foreground

Command Effect
fg Brings a suspended job to the foreground.
fg id Brings the job corresponding to job-ID id to the foreground.

Terminating a job/process

Command Effect
Type Ctrl-C Terminates (kills) the foreground job/process.
kill -KILL id Terminates (kills) the job/process with job-ID/PID id.
faq/linuxref/jobctrl.txt · Last modified: 2011/03/29 22:26 (external edit)
GNU Free Documentation License 1.3
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0