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.