ℹ️ Skipped - page is already crawled
| Filter | Status | Condition | Details |
|---|---|---|---|
| HTTP status | PASS | download_http_code = 200 | HTTP 200 |
| Age cutoff | PASS | download_stamp > now() - 6 MONTH | 0.6 months ago (distributed domain, exempt) |
| History drop | PASS | isNull(history_drop_reason) | No drop reason |
| Spam/ban | PASS | fh_dont_index != 1 AND ml_spam_score = 0 | ml_spam_score=0 |
| Canonical | PASS | meta_canonical IS NULL OR = '' OR = src_unparsed | Not set |
| Property | Value |
|---|---|
| URL | https://en.wikipedia.org/wiki/Job_control_(Unix) |
| Last Crawled | 2026-03-25 13:40:58 (18 days ago) |
| First Indexed | 2015-06-30 22:33:51 (10 years ago) |
| HTTP Status Code | 200 |
| Meta Title | Job control (Unix) - Wikipedia |
| Meta Description | null |
| Meta Canonical | null |
| Boilerpipe Text | From Wikipedia, the free encyclopedia
This article is about job control on a Unix-based system. For the general computing term, see
job control
.
In a
Unix
or
Unix-like
operating system
,
job control
refers to controlling a
process group
as a
job
via a
shell
.
[
1
]
Control features include suspend, resume, and terminate, and more advanced features can be performed by sending a
signal
to a job. Job control allows a user to manage processing in the Unix-based
multiprocessing
environment, and is distinct from
general computing job control
.
Job control was first implemented in the
C shell
by Jim Kulp,
[
2
]
then at
IIASA
in Austria, making use of features of the 4.1
BSD
kernel.
The
KornShell
, developed at
Bell Labs
, adopted it and it was later incorporated into the SVR4 version of the
Bourne shell
, and exists in most modern Unix shells.
A job encompasses all of the processes that start for the handling of a shell
command line
. A simple command line may start just one process, but a command line may result in multiple processes since a process can create
child processes
, and a command line can specify a
pipeline
of multiple commands. For example, the following command line selects lines containing the text "title", sorts them alphabetically, and displays the result in a
terminal pager
:
grep title somefile.txt | sort | less
. This creates at least three processes: one for
grep
, one for
sort
, and one for
less
. Job control allows the shell to control these processes as one entity.
A job is identified by a numeric
job ID
, a.k.a.
job number
which is classified as a
handle
since it is an abstract reference to a
resource
(a process group). An ID value, prefixed with
%
, can be used with a job control command to specify a job. The special references
%%
and
%+
refer to the default job, the one that would be selected if none were specified.
[
3
]
Bash documentation refers to a reference (starting with
%
) as a
jobspec
(short for job specification).
[
4
]
Job control ID values are typically only used in an interactive shell. In scripting, PGID values are used instead, as they are more precise and robust, and indeed job control is disabled by default in a bash script.
Foreground/background
[
edit
]
By default, a job runs in the foreground where it uses
interactive input and output
. The user enters a command line and interacts with the processes but cannot issue another command until the current job terminates. Many operations (i.e. listing files) are relatively quick so the user can wait for a response with little down time and some operations (i.e. editing) require interaction that is only possible via a foreground job. But, if interaction is not required and the operation prevents access to the shell for a long time, the user may want to run it in the background – where the processes cannot access interactive input but the user can perform other foreground operations while the background job runs concurrently. By default background jobs output to the interactive output stream which results in the interleaving of output from the foreground and background jobs although a user may
redirect
output for a background job to prevent this.
POSIX
specifies the
user interface
to job control – modeled on the Korn shell.
[
5
]
The commands are typically implemented as
shell builtins
, not separate
programs
.
Start in background
If a command line ends with
&
, then the job starts in the background.
Pause foreground job
The foreground job can be paused by pressing
Ctrl
+
Z
. In this state, a job can be resumed in the background via
bg
or resumed in the foreground via
fg
.
Command
fg
Command
fg
(short for
f
ore
g
round) moves background job to the foreground, either the job specified or the one most recently added to the background if none specified. When the foreground job is paused (via
Ctrl
+
Z
), then this command resumes that job.
Command
wait
Command
wait
pauses the interactive session until the specified background jobs complete or for all background jobs of the active shell if none specified.
[
6
]
Command
bg
Command
bg
(short for
b
ack
g
round) moves the paused foreground job to the background and resumes it.
Command
jobs
Command
jobs
reports information about each background job including ID, command line and running status (stopped or running).
The
interprocess communication
of job control is implemented via
signals
.
Typically, a shell maintains information about background jobs in a job table. When an
interactive session
ends (i.e. user
logs out
), the shell sends signal
SIGHUP
to all jobs, and waits for the process groups to exit before terminating itself. Some shells provide a non-POSIX command
disown
that removes a job from the job table. The process group becomes an
orphan
. The shell will not send it SIGHUP, nor wait for it to terminate. This is one technique for enabling a process as a
daemon
owned directly by the root process
init
. The POSIX command
nohup
provides an alternate way to prevent a job from being terminated by the shell.
Suspending the foreground job (via
Ctrl
+
Z
) sends signal SIGTSTP (terminal stop) to the processes of the group. By default, this signal causes a process to pause so that the shell can resume. However, a process can ignore the signal. A process can also be paused via signal SIGSTOP (stop), which cannot be ignored.
When the user presses
Ctrl
+
C
, the shell sends signal
SIGINT
(interrupt) to each foreground job process, which defaults to terminating it, though a process can ignore the signal.
When a stopped job is resumed (via
bg
or
fg
), the shell redirects
Input/output
and resumes it by sending signal SIGCONT to it.
A background process that attempts to read from or write to its
controlling terminal
is sent signal SIGTTIN (for input) or SIGTTOU (for output). These signals stop the process by default, but they may also be handled in other ways. Shells often override the default stop action of SIGTTOU so that background processes deliver their output to the controlling terminal by default.
In bash, the
kill
builtin (not
/bin/kill
) can signal jobs by ID as well as by process group ID. Sending a signal to a job sends it to each process of the group.
kill
can send any signal to a job; however, if the intent is to rid the system of the processes, the signals
SIGKILL
and
SIGTERM
(the default) are probably the most applicable.
^
IEEE Std 1003.1-2001,
Section 3.201, Job
Archived
2019-08-01 at the
Wayback Machine
^
Foreword by
Bill Joy
in
Anderson, Gail; Paul Anderson (1986).
The UNIX C Shell Field Guide
. Prentice-Hall. p. xvii.
ISBN
0-13-937468-X
.
^
IEEE Std 1003.1-2001,
Section 3.203, Job Control Job ID
Archived
2010-10-09 at the
Wayback Machine
^
"7.1 Job Control Basics"
.
Archived
from the original on 2016-08-02
. Retrieved
2016-07-22
.
^
bg
– Shell and Utilities Reference,
The Single UNIX Specification
, Version 5 from
The Open Group
;
fg
– Shell and Utilities Reference,
The Single UNIX Specification
, Version 5 from
The Open Group
.
^
Kerrisk, Michael (Feb 2, 2025).
"wait(1p) — Linux manual page"
.
man7.org
.
Archived
from the original on May 16, 2025
. Retrieved
May 13,
2025
.
Marshall Kirk McKusick
and George V. Neville-Neil (2004-08-02).
"FreeBSD Process Management: Process Groups and Sessions"
.
The Design and Implementation of the FreeBSD Operating System
. Addison Wesley.
ISBN
0-201-70245-2
.
"Job Control",
Bash Reference Manual |
| Markdown | [Jump to content](https://en.wikipedia.org/wiki/Job_control_\(Unix\)#bodyContent)
Main menu
Main menu
move to sidebar
hide
Navigation
- [Main page](https://en.wikipedia.org/wiki/Main_Page "Visit the main page [z]")
- [Contents](https://en.wikipedia.org/wiki/Wikipedia:Contents "Guides to browsing Wikipedia")
- [Current events](https://en.wikipedia.org/wiki/Portal:Current_events "Articles related to current events")
- [Random article](https://en.wikipedia.org/wiki/Special:Random "Visit a randomly selected article [x]")
- [About Wikipedia](https://en.wikipedia.org/wiki/Wikipedia:About "Learn about Wikipedia and how it works")
- [Contact us](https://en.wikipedia.org/wiki/Wikipedia:Contact_us "How to contact Wikipedia")
Contribute
- [Help](https://en.wikipedia.org/wiki/Help:Contents "Guidance on how to use and edit Wikipedia")
- [Learn to edit](https://en.wikipedia.org/wiki/Help:Introduction "Learn how to edit Wikipedia")
- [Community portal](https://en.wikipedia.org/wiki/Wikipedia:Community_portal "The hub for editors")
- [Recent changes](https://en.wikipedia.org/wiki/Special:RecentChanges "A list of recent changes to Wikipedia [r]")
- [Upload file](https://en.wikipedia.org/wiki/Wikipedia:File_upload_wizard "Add images or other media for use on Wikipedia")
- [Special pages](https://en.wikipedia.org/wiki/Special:SpecialPages "A list of all special pages [q]")
[  ](https://en.wikipedia.org/wiki/Main_Page)
[Search](https://en.wikipedia.org/wiki/Special:Search "Search Wikipedia [f]")
Appearance
- [Donate](https://donate.wikimedia.org/?wmf_source=donate&wmf_medium=sidebar&wmf_campaign=en.wikipedia.org&uselang=en)
- [Create account](https://en.wikipedia.org/w/index.php?title=Special:CreateAccount&returnto=Job+control+%28Unix%29 "You are encouraged to create an account and log in; however, it is not mandatory")
- [Log in](https://en.wikipedia.org/w/index.php?title=Special:UserLogin&returnto=Job+control+%28Unix%29 "You're encouraged to log in; however, it's not mandatory. [o]")
Personal tools
- [Donate](https://donate.wikimedia.org/?wmf_source=donate&wmf_medium=sidebar&wmf_campaign=en.wikipedia.org&uselang=en)
- [Create account](https://en.wikipedia.org/w/index.php?title=Special:CreateAccount&returnto=Job+control+%28Unix%29 "You are encouraged to create an account and log in; however, it is not mandatory")
- [Log in](https://en.wikipedia.org/w/index.php?title=Special:UserLogin&returnto=Job+control+%28Unix%29 "You're encouraged to log in; however, it's not mandatory. [o]")
## Contents
move to sidebar
hide
- [(Top)](https://en.wikipedia.org/wiki/Job_control_\(Unix\))
- [1 Job](https://en.wikipedia.org/wiki/Job_control_\(Unix\)#Job)
- [2 Job ID](https://en.wikipedia.org/wiki/Job_control_\(Unix\)#Job_ID)
- [3 Foreground/background](https://en.wikipedia.org/wiki/Job_control_\(Unix\)#Foreground/background)
- [4 Control](https://en.wikipedia.org/wiki/Job_control_\(Unix\)#Control)
- [5 Signals](https://en.wikipedia.org/wiki/Job_control_\(Unix\)#Signals)
- [6 References](https://en.wikipedia.org/wiki/Job_control_\(Unix\)#References)
- [7 Further reading](https://en.wikipedia.org/wiki/Job_control_\(Unix\)#Further_reading)
- [8 External links](https://en.wikipedia.org/wiki/Job_control_\(Unix\)#External_links)
Toggle the table of contents
# Job control (Unix)
7 languages
- [Català](https://ca.wikipedia.org/wiki/Control_de_tasques_\(Unix\) "Control de tasques (Unix) – Catalan")
- [Čeština](https://cs.wikipedia.org/wiki/%C5%98%C3%ADzen%C3%AD_%C3%BAloh_\(Unix\) "Řízení úloh (Unix) – Czech")
- [Deutsch](https://de.wikipedia.org/wiki/Job_control "Job control – German")
- [Français](https://fr.wikipedia.org/wiki/SIGTSTP "SIGTSTP – French")
- [한국어](https://ko.wikipedia.org/wiki/Jobs_\(%EC%9C%A0%EB%8B%89%EC%8A%A4\) "Jobs (유닉스) – Korean")
- [Português](https://pt.wikipedia.org/wiki/Controle_de_trabalhos_\(Unix\) "Controle de trabalhos (Unix) – Portuguese")
- [Русский](https://ru.wikipedia.org/wiki/%D0%A3%D0%BF%D1%80%D0%B0%D0%B2%D0%BB%D0%B5%D0%BD%D0%B8%D0%B5_%D0%B7%D0%B0%D0%B4%D0%B0%D0%BD%D0%B8%D1%8F%D0%BC%D0%B8 "Управление заданиями – Russian")
[Edit links](https://www.wikidata.org/wiki/Special:EntityPage/Q6206712#sitelinks-wikipedia "Edit interlanguage links")
- [Article](https://en.wikipedia.org/wiki/Job_control_\(Unix\) "View the content page [c]")
- [Talk](https://en.wikipedia.org/wiki/Talk:Job_control_\(Unix\) "Discuss improvements to the content page [t]")
English
- [Read](https://en.wikipedia.org/wiki/Job_control_\(Unix\))
- [Edit](https://en.wikipedia.org/w/index.php?title=Job_control_\(Unix\)&action=edit "Edit this page [e]")
- [View history](https://en.wikipedia.org/w/index.php?title=Job_control_\(Unix\)&action=history "Past revisions of this page [h]")
Tools
Tools
move to sidebar
hide
Actions
- [Read](https://en.wikipedia.org/wiki/Job_control_\(Unix\))
- [Edit](https://en.wikipedia.org/w/index.php?title=Job_control_\(Unix\)&action=edit "Edit this page [e]")
- [View history](https://en.wikipedia.org/w/index.php?title=Job_control_\(Unix\)&action=history)
General
- [What links here](https://en.wikipedia.org/wiki/Special:WhatLinksHere/Job_control_\(Unix\) "List of all English Wikipedia pages containing links to this page [j]")
- [Related changes](https://en.wikipedia.org/wiki/Special:RecentChangesLinked/Job_control_\(Unix\) "Recent changes in pages linked from this page [k]")
- [Upload file](https://en.wikipedia.org/wiki/Wikipedia:File_Upload_Wizard "Upload files [u]")
- [Permanent link](https://en.wikipedia.org/w/index.php?title=Job_control_\(Unix\)&oldid=1336330596 "Permanent link to this revision of this page")
- [Page information](https://en.wikipedia.org/w/index.php?title=Job_control_\(Unix\)&action=info "More information about this page")
- [Cite this page](https://en.wikipedia.org/w/index.php?title=Special:CiteThisPage&page=Job_control_%28Unix%29&id=1336330596&wpFormIdentifier=titleform "Information on how to cite this page")
- [Get shortened URL](https://en.wikipedia.org/w/index.php?title=Special:UrlShortener&url=https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FJob_control_%28Unix%29)
Print/export
- [Download as PDF](https://en.wikipedia.org/w/index.php?title=Special:DownloadAsPdf&page=Job_control_%28Unix%29&action=show-download-screen "Download this page as a PDF file")
- [Printable version](https://en.wikipedia.org/w/index.php?title=Job_control_\(Unix\)&printable=yes "Printable version of this page [p]")
In other projects
- [Wikidata item](https://www.wikidata.org/wiki/Special:EntityPage/Q6206712 "Structured data on this page hosted by Wikidata [g]")
Appearance
move to sidebar
hide
From Wikipedia, the free encyclopedia
Control of jobs in a Unix shell
This article is about job control on a Unix-based system. For the general computing term, see [job control](https://en.wikipedia.org/wiki/Job_control_\(computing\) "Job control (computing)").
In a [Unix](https://en.wikipedia.org/wiki/Unix "Unix") or [Unix-like](https://en.wikipedia.org/wiki/Unix-like "Unix-like") [operating system](https://en.wikipedia.org/wiki/Operating_system "Operating system"), **job control** refers to controlling a [process group](https://en.wikipedia.org/wiki/Process_group "Process group") as a [job](https://en.wikipedia.org/wiki/Job_\(computing\) "Job (computing)") via a [shell](https://en.wikipedia.org/wiki/Unix_shell "Unix shell").[\[1\]](https://en.wikipedia.org/wiki/Job_control_\(Unix\)#cite_note-1) Control features include suspend, resume, and terminate, and more advanced features can be performed by sending a [signal](https://en.wikipedia.org/wiki/Signal_\(IPC\) "Signal (IPC)") to a job. Job control allows a user to manage processing in the Unix-based [multiprocessing](https://en.wikipedia.org/wiki/Multiprocessing "Multiprocessing") environment, and is distinct from [general computing job control](https://en.wikipedia.org/wiki/Job_control_\(computing\) "Job control (computing)").
Job control was first implemented in the [C shell](https://en.wikipedia.org/wiki/C_shell "C shell") by Jim Kulp,[\[2\]](https://en.wikipedia.org/wiki/Job_control_\(Unix\)#cite_note-2) then at [IIASA](https://en.wikipedia.org/wiki/IIASA "IIASA") in Austria, making use of features of the 4.1[BSD](https://en.wikipedia.org/wiki/BSD "BSD") kernel. The [KornShell](https://en.wikipedia.org/wiki/KornShell "KornShell"), developed at [Bell Labs](https://en.wikipedia.org/wiki/Bell_Labs "Bell Labs"), adopted it and it was later incorporated into the SVR4 version of the [Bourne shell](https://en.wikipedia.org/wiki/Bourne_shell "Bourne shell"), and exists in most modern Unix shells.
## Job
\[[edit](https://en.wikipedia.org/w/index.php?title=Job_control_\(Unix\)&action=edit§ion=1 "Edit section: Job")\]
A job encompasses all of the processes that start for the handling of a shell [command line](https://en.wikipedia.org/wiki/Command-line_interface "Command-line interface"). A simple command line may start just one process, but a command line may result in multiple processes since a process can create [child processes](https://en.wikipedia.org/wiki/Child_process "Child process"), and a command line can specify a [pipeline](https://en.wikipedia.org/wiki/Pipeline_\(Unix\) "Pipeline (Unix)") of multiple commands. For example, the following command line selects lines containing the text "title", sorts them alphabetically, and displays the result in a [terminal pager](https://en.wikipedia.org/wiki/Terminal_pager "Terminal pager"): `grep title somefile.txt | sort | less`. This creates at least three processes: one for [`grep`](https://en.wikipedia.org/wiki/Grep "Grep"), one for `sort`, and one for [`less`](https://en.wikipedia.org/wiki/Less_\(Unix\) "Less (Unix)"). Job control allows the shell to control these processes as one entity.
## Job ID
\[[edit](https://en.wikipedia.org/w/index.php?title=Job_control_\(Unix\)&action=edit§ion=2 "Edit section: Job ID")\]
A job is identified by a numeric *job ID*, a.k.a. *job number* which is classified as a [handle](https://en.wikipedia.org/wiki/Handle_\(computing\) "Handle (computing)") since it is an abstract reference to a [resource](https://en.wikipedia.org/wiki/System_resource "System resource") (a process group). An ID value, prefixed with `%`, can be used with a job control command to specify a job. The special references `%%` and `%+` refer to the default job, the one that would be selected if none were specified.[\[3\]](https://en.wikipedia.org/wiki/Job_control_\(Unix\)#cite_note-3) Bash documentation refers to a reference (starting with `%`) as a *jobspec* (short for job specification).[\[4\]](https://en.wikipedia.org/wiki/Job_control_\(Unix\)#cite_note-4)
Job control ID values are typically only used in an interactive shell. In scripting, PGID values are used instead, as they are more precise and robust, and indeed job control is disabled by default in a bash script.
## Foreground/background
\[[edit](https://en.wikipedia.org/w/index.php?title=Job_control_\(Unix\)&action=edit§ion=3 "Edit section: Foreground/background")\]
By default, a job runs in the foreground where it uses [interactive input and output](https://en.wikipedia.org/wiki/Standard_streams "Standard streams"). The user enters a command line and interacts with the processes but cannot issue another command until the current job terminates. Many operations (i.e. listing files) are relatively quick so the user can wait for a response with little down time and some operations (i.e. editing) require interaction that is only possible via a foreground job. But, if interaction is not required and the operation prevents access to the shell for a long time, the user may want to run it in the background – where the processes cannot access interactive input but the user can perform other foreground operations while the background job runs concurrently. By default background jobs output to the interactive output stream which results in the interleaving of output from the foreground and background jobs although a user may [redirect](https://en.wikipedia.org/wiki/Redirection_\(computing\) "Redirection (computing)") output for a background job to prevent this.
## Control
\[[edit](https://en.wikipedia.org/w/index.php?title=Job_control_\(Unix\)&action=edit§ion=4 "Edit section: Control")\]
[POSIX](https://en.wikipedia.org/wiki/POSIX "POSIX") specifies the [user interface](https://en.wikipedia.org/wiki/User_interface "User interface") to job control – modeled on the Korn shell.[\[5\]](https://en.wikipedia.org/wiki/Job_control_\(Unix\)#cite_note-5) The commands are typically implemented as [shell builtins](https://en.wikipedia.org/wiki/Shell_builtin "Shell builtin"), not separate [programs](https://en.wikipedia.org/wiki/Computer_program "Computer program").
Start in background
If a command line ends with `&`, then the job starts in the background.
Pause foreground job
The foreground job can be paused by pressing `Ctrl`\+` Z`. In this state, a job can be resumed in the background via `bg` or resumed in the foreground via `fg`.
Command `fg`
Command `fg` (short for **f**ore**g**round) moves background job to the foreground, either the job specified or the one most recently added to the background if none specified. When the foreground job is paused (via
`Ctrl`\+` Z`), then this command resumes that job.
Command `wait`
Command [`wait`](https://en.wikipedia.org/wiki/Wait_\(command\) "Wait (command)") pauses the interactive session until the specified background jobs complete or for all background jobs of the active shell if none specified.[\[6\]](https://en.wikipedia.org/wiki/Job_control_\(Unix\)#cite_note-6)
Command `bg`
Command `bg` (short for **b**ack**g**round) moves the paused foreground job to the background and resumes it.
Command `jobs`
Command `jobs` reports information about each background job including ID, command line and running status (stopped or running).
## Signals
\[[edit](https://en.wikipedia.org/w/index.php?title=Job_control_\(Unix\)&action=edit§ion=5 "Edit section: Signals")\]
| | |
|---|---|
| [](https://en.wikipedia.org/wiki/File:Question_book-new.svg) | This section **does not [cite](https://en.wikipedia.org/wiki/Wikipedia:Citing_sources "Wikipedia:Citing sources") any [sources](https://en.wikipedia.org/wiki/Wikipedia:Verifiability "Wikipedia:Verifiability")**. Please help [improve this section](https://en.wikipedia.org/wiki/Special:EditPage/Job_control_\(Unix\) "Special:EditPage/Job control (Unix)") by [adding citations to reliable sources](https://en.wikipedia.org/wiki/Help:Referencing_for_beginners "Help:Referencing for beginners"). Unsourced material may be challenged and [removed](https://en.wikipedia.org/wiki/Wikipedia:Verifiability#Burden_of_evidence "Wikipedia:Verifiability"). *(February 2020)* *([Learn how and when to remove this message](https://en.wikipedia.org/wiki/Help:Maintenance_template_removal "Help:Maintenance template removal"))* |
The [interprocess communication](https://en.wikipedia.org/wiki/Interprocess_communication "Interprocess communication") of job control is implemented via [signals](https://en.wikipedia.org/wiki/Signal_\(IPC\) "Signal (IPC)").
Typically, a shell maintains information about background jobs in a job table. When an [interactive session](https://en.wikipedia.org/wiki/Login_session "Login session") ends (i.e. user [logs out](https://en.wikipedia.org/wiki/Logout "Logout")), the shell sends signal [SIGHUP](https://en.wikipedia.org/wiki/SIGHUP "SIGHUP") to all jobs, and waits for the process groups to exit before terminating itself. Some shells provide a non-POSIX command [`disown`](https://en.wikipedia.org/wiki/Disown_\(Unix\) "Disown (Unix)") that removes a job from the job table. The process group becomes an [orphan](https://en.wikipedia.org/wiki/Orphan_process "Orphan process"). The shell will not send it SIGHUP, nor wait for it to terminate. This is one technique for enabling a process as a [daemon](https://en.wikipedia.org/wiki/Daemon_\(computing\) "Daemon (computing)") owned directly by the root process [init](https://en.wikipedia.org/wiki/Init "Init"). The POSIX command [`nohup`](https://en.wikipedia.org/wiki/Nohup "Nohup") provides an alternate way to prevent a job from being terminated by the shell.
Suspending the foreground job (via `Ctrl`\+`Z`) sends signal SIGTSTP (terminal stop) to the processes of the group. By default, this signal causes a process to pause so that the shell can resume. However, a process can ignore the signal. A process can also be paused via signal SIGSTOP (stop), which cannot be ignored.
When the user presses `Ctrl`\+`C`, the shell sends signal [SIGINT](https://en.wikipedia.org/wiki/SIGINT_\(POSIX\) "SIGINT (POSIX)") (interrupt) to each foreground job process, which defaults to terminating it, though a process can ignore the signal.
When a stopped job is resumed (via `bg` or `fg`), the shell redirects [Input/output](https://en.wikipedia.org/wiki/Input/output "Input/output") and resumes it by sending signal SIGCONT to it.
A background process that attempts to read from or write to its [controlling terminal](https://en.wikipedia.org/wiki/Controlling_terminal "Controlling terminal") is sent signal SIGTTIN (for input) or SIGTTOU (for output). These signals stop the process by default, but they may also be handled in other ways. Shells often override the default stop action of SIGTTOU so that background processes deliver their output to the controlling terminal by default.
In bash, the `kill` builtin (not `/bin/kill`) can signal jobs by ID as well as by process group ID. Sending a signal to a job sends it to each process of the group. `kill` can send any signal to a job; however, if the intent is to rid the system of the processes, the signals [SIGKILL](https://en.wikipedia.org/wiki/SIGKILL "SIGKILL") and [SIGTERM](https://en.wikipedia.org/wiki/SIGTERM "SIGTERM") (the default) are probably the most applicable.
## References
\[[edit](https://en.wikipedia.org/w/index.php?title=Job_control_\(Unix\)&action=edit§ion=6 "Edit section: References")\]
1. **[^](https://en.wikipedia.org/wiki/Job_control_\(Unix\)#cite_ref-1)** IEEE Std 1003.1-2001, [Section 3.201, Job](http://pubs.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap03.html#tag_03_201) [Archived](https://web.archive.org/web/20190801165956/http://pubs.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap03.html#tag_03_201) 2019-08-01 at the [Wayback Machine](https://en.wikipedia.org/wiki/Wayback_Machine "Wayback Machine")
2. **[^](https://en.wikipedia.org/wiki/Job_control_\(Unix\)#cite_ref-2)**
Foreword by [Bill Joy](https://en.wikipedia.org/wiki/Bill_Joy "Bill Joy") in
Anderson, Gail; Paul Anderson (1986). [*The UNIX C Shell Field Guide*](https://archive.org/details/unixcshellfieldg00ande). Prentice-Hall. p. xvii. [ISBN](https://en.wikipedia.org/wiki/ISBN_\(identifier\) "ISBN (identifier)")
[0-13-937468-X](https://en.wikipedia.org/wiki/Special:BookSources/0-13-937468-X "Special:BookSources/0-13-937468-X")
.
3. **[^](https://en.wikipedia.org/wiki/Job_control_\(Unix\)#cite_ref-3)** IEEE Std 1003.1-2001, [Section 3.203, Job Control Job ID](http://www.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap03.html#tag_03_203) [Archived](https://web.archive.org/web/20101009060625/http://www.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap03.html#tag_03_203) 2010-10-09 at the [Wayback Machine](https://en.wikipedia.org/wiki/Wayback_Machine "Wayback Machine")
4. **[^](https://en.wikipedia.org/wiki/Job_control_\(Unix\)#cite_ref-4)**
["7.1 Job Control Basics"](https://www.gnu.org/software/bash/manual/html_node/Job-Control-Basics.html#Job-Control-Basics). [Archived](https://web.archive.org/web/20160802215912/http://www.gnu.org/software/bash/manual/html_node/Job-Control-Basics.html#Job-Control-Basics) from the original on 2016-08-02. Retrieved 2016-07-22.
5. **[^](https://en.wikipedia.org/wiki/Job_control_\(Unix\)#cite_ref-5)** `bg` – Shell and Utilities Reference, [The Single UNIX Specification](https://en.wikipedia.org/wiki/Single_Unix_Specification "Single Unix Specification"), Version 5 from [The Open Group](https://en.wikipedia.org/wiki/The_Open_Group "The Open Group"); `fg` – Shell and Utilities Reference, [The Single UNIX Specification](https://en.wikipedia.org/wiki/Single_Unix_Specification "Single Unix Specification"), Version 5 from [The Open Group](https://en.wikipedia.org/wiki/The_Open_Group "The Open Group").
6. **[^](https://en.wikipedia.org/wiki/Job_control_\(Unix\)#cite_ref-6)**
Kerrisk, Michael (Feb 2, 2025). ["wait(1p) — Linux manual page"](https://www.man7.org/linux/man-pages/man1/wait.1p.html). *man7.org*. [Archived](https://web.archive.org/web/20250516160332/https://www.man7.org/linux/man-pages/man1/wait.1p.html) from the original on May 16, 2025. Retrieved May 13, 2025.
## Further reading
\[[edit](https://en.wikipedia.org/w/index.php?title=Job_control_\(Unix\)&action=edit§ion=7 "Edit section: Further reading")\]
- [Marshall Kirk McKusick](https://en.wikipedia.org/wiki/Marshall_Kirk_McKusick "Marshall Kirk McKusick") and George V. Neville-Neil (2004-08-02). ["FreeBSD Process Management: Process Groups and Sessions"](http://www.informit.com/articles/article.aspx?p=366888&seqNum=8). [*The Design and Implementation of the FreeBSD Operating System*](http://www.informit.com/title/0201702452). Addison Wesley. [ISBN](https://en.wikipedia.org/wiki/ISBN_\(identifier\) "ISBN (identifier)")
[0-201-70245-2](https://en.wikipedia.org/wiki/Special:BookSources/0-201-70245-2 "Special:BookSources/0-201-70245-2")
.
## External links
\[[edit](https://en.wikipedia.org/w/index.php?title=Job_control_\(Unix\)&action=edit§ion=8 "Edit section: External links")\]
- "Job Control", [*Bash Reference Manual*](https://web.archive.org/web/20060523213233/http://cnswww.cns.cwru.edu/~chet/bash/bashref.html)

Retrieved from "<https://en.wikipedia.org/w/index.php?title=Job_control_(Unix)&oldid=1336330596>"
[Category](https://en.wikipedia.org/wiki/Help:Category "Help:Category"):
- [Unix](https://en.wikipedia.org/wiki/Category:Unix "Category:Unix")
Hidden categories:
- [Webarchive template wayback links](https://en.wikipedia.org/wiki/Category:Webarchive_template_wayback_links "Category:Webarchive template wayback links")
- [Articles with short description](https://en.wikipedia.org/wiki/Category:Articles_with_short_description "Category:Articles with short description")
- [Short description is different from Wikidata](https://en.wikipedia.org/wiki/Category:Short_description_is_different_from_Wikidata "Category:Short description is different from Wikidata")
- [Articles needing additional references from February 2020](https://en.wikipedia.org/wiki/Category:Articles_needing_additional_references_from_February_2020 "Category:Articles needing additional references from February 2020")
- [All articles needing additional references](https://en.wikipedia.org/wiki/Category:All_articles_needing_additional_references "Category:All articles needing additional references")
- This page was last edited on 3 February 2026, at 04:48 (UTC).
- Text is available under the [Creative Commons Attribution-ShareAlike 4.0 License](https://en.wikipedia.org/wiki/Wikipedia:Text_of_the_Creative_Commons_Attribution-ShareAlike_4.0_International_License "Wikipedia:Text of the Creative Commons Attribution-ShareAlike 4.0 International License"); additional terms may apply. By using this site, you agree to the [Terms of Use](https://foundation.wikimedia.org/wiki/Special:MyLanguage/Policy:Terms_of_Use "foundation:Special:MyLanguage/Policy:Terms of Use") and [Privacy Policy](https://foundation.wikimedia.org/wiki/Special:MyLanguage/Policy:Privacy_policy "foundation:Special:MyLanguage/Policy:Privacy policy"). Wikipedia® is a registered trademark of the [Wikimedia Foundation, Inc.](https://wikimediafoundation.org/), a non-profit organization.
- [Privacy policy](https://foundation.wikimedia.org/wiki/Special:MyLanguage/Policy:Privacy_policy)
- [About Wikipedia](https://en.wikipedia.org/wiki/Wikipedia:About)
- [Disclaimers](https://en.wikipedia.org/wiki/Wikipedia:General_disclaimer)
- [Contact Wikipedia](https://en.wikipedia.org/wiki/Wikipedia:Contact_us)
- [Legal & safety contacts](https://foundation.wikimedia.org/wiki/Special:MyLanguage/Legal:Wikimedia_Foundation_Legal_and_Safety_Contact_Information)
- [Code of Conduct](https://foundation.wikimedia.org/wiki/Special:MyLanguage/Policy:Universal_Code_of_Conduct)
- [Developers](https://developer.wikimedia.org/)
- [Statistics](https://stats.wikimedia.org/#/en.wikipedia.org)
- [Cookie statement](https://foundation.wikimedia.org/wiki/Special:MyLanguage/Policy:Cookie_statement)
- [Mobile view](https://en.wikipedia.org/w/index.php?title=Job_control_\(Unix\)&mobileaction=toggle_view_mobile)
- [](https://www.wikimedia.org/)
- [](https://www.mediawiki.org/)
Search
Toggle the table of contents
Job control (Unix)
7 languages
[Add topic](https://en.wikipedia.org/wiki/Job_control_\(Unix\)) |
| Readable Markdown | From Wikipedia, the free encyclopedia
This article is about job control on a Unix-based system. For the general computing term, see [job control](https://en.wikipedia.org/wiki/Job_control_\(computing\) "Job control (computing)").
In a [Unix](https://en.wikipedia.org/wiki/Unix "Unix") or [Unix-like](https://en.wikipedia.org/wiki/Unix-like "Unix-like") [operating system](https://en.wikipedia.org/wiki/Operating_system "Operating system"), **job control** refers to controlling a [process group](https://en.wikipedia.org/wiki/Process_group "Process group") as a [job](https://en.wikipedia.org/wiki/Job_\(computing\) "Job (computing)") via a [shell](https://en.wikipedia.org/wiki/Unix_shell "Unix shell").[\[1\]](https://en.wikipedia.org/wiki/Job_control_\(Unix\)#cite_note-1) Control features include suspend, resume, and terminate, and more advanced features can be performed by sending a [signal](https://en.wikipedia.org/wiki/Signal_\(IPC\) "Signal (IPC)") to a job. Job control allows a user to manage processing in the Unix-based [multiprocessing](https://en.wikipedia.org/wiki/Multiprocessing "Multiprocessing") environment, and is distinct from [general computing job control](https://en.wikipedia.org/wiki/Job_control_\(computing\) "Job control (computing)").
Job control was first implemented in the [C shell](https://en.wikipedia.org/wiki/C_shell "C shell") by Jim Kulp,[\[2\]](https://en.wikipedia.org/wiki/Job_control_\(Unix\)#cite_note-2) then at [IIASA](https://en.wikipedia.org/wiki/IIASA "IIASA") in Austria, making use of features of the 4.1[BSD](https://en.wikipedia.org/wiki/BSD "BSD") kernel. The [KornShell](https://en.wikipedia.org/wiki/KornShell "KornShell"), developed at [Bell Labs](https://en.wikipedia.org/wiki/Bell_Labs "Bell Labs"), adopted it and it was later incorporated into the SVR4 version of the [Bourne shell](https://en.wikipedia.org/wiki/Bourne_shell "Bourne shell"), and exists in most modern Unix shells.
A job encompasses all of the processes that start for the handling of a shell [command line](https://en.wikipedia.org/wiki/Command-line_interface "Command-line interface"). A simple command line may start just one process, but a command line may result in multiple processes since a process can create [child processes](https://en.wikipedia.org/wiki/Child_process "Child process"), and a command line can specify a [pipeline](https://en.wikipedia.org/wiki/Pipeline_\(Unix\) "Pipeline (Unix)") of multiple commands. For example, the following command line selects lines containing the text "title", sorts them alphabetically, and displays the result in a [terminal pager](https://en.wikipedia.org/wiki/Terminal_pager "Terminal pager"): `grep title somefile.txt | sort | less`. This creates at least three processes: one for [`grep`](https://en.wikipedia.org/wiki/Grep "Grep"), one for `sort`, and one for [`less`](https://en.wikipedia.org/wiki/Less_\(Unix\) "Less (Unix)"). Job control allows the shell to control these processes as one entity.
A job is identified by a numeric *job ID*, a.k.a. *job number* which is classified as a [handle](https://en.wikipedia.org/wiki/Handle_\(computing\) "Handle (computing)") since it is an abstract reference to a [resource](https://en.wikipedia.org/wiki/System_resource "System resource") (a process group). An ID value, prefixed with `%`, can be used with a job control command to specify a job. The special references `%%` and `%+` refer to the default job, the one that would be selected if none were specified.[\[3\]](https://en.wikipedia.org/wiki/Job_control_\(Unix\)#cite_note-3) Bash documentation refers to a reference (starting with `%`) as a *jobspec* (short for job specification).[\[4\]](https://en.wikipedia.org/wiki/Job_control_\(Unix\)#cite_note-4)
Job control ID values are typically only used in an interactive shell. In scripting, PGID values are used instead, as they are more precise and robust, and indeed job control is disabled by default in a bash script.
## Foreground/background
\[[edit](https://en.wikipedia.org/w/index.php?title=Job_control_\(Unix\)&action=edit§ion=3 "Edit section: Foreground/background")\]
By default, a job runs in the foreground where it uses [interactive input and output](https://en.wikipedia.org/wiki/Standard_streams "Standard streams"). The user enters a command line and interacts with the processes but cannot issue another command until the current job terminates. Many operations (i.e. listing files) are relatively quick so the user can wait for a response with little down time and some operations (i.e. editing) require interaction that is only possible via a foreground job. But, if interaction is not required and the operation prevents access to the shell for a long time, the user may want to run it in the background – where the processes cannot access interactive input but the user can perform other foreground operations while the background job runs concurrently. By default background jobs output to the interactive output stream which results in the interleaving of output from the foreground and background jobs although a user may [redirect](https://en.wikipedia.org/wiki/Redirection_\(computing\) "Redirection (computing)") output for a background job to prevent this.
[POSIX](https://en.wikipedia.org/wiki/POSIX "POSIX") specifies the [user interface](https://en.wikipedia.org/wiki/User_interface "User interface") to job control – modeled on the Korn shell.[\[5\]](https://en.wikipedia.org/wiki/Job_control_\(Unix\)#cite_note-5) The commands are typically implemented as [shell builtins](https://en.wikipedia.org/wiki/Shell_builtin "Shell builtin"), not separate [programs](https://en.wikipedia.org/wiki/Computer_program "Computer program").
Start in background
If a command line ends with `&`, then the job starts in the background.
Pause foreground job
The foreground job can be paused by pressing `Ctrl`\+` Z`. In this state, a job can be resumed in the background via `bg` or resumed in the foreground via `fg`.
Command `fg`
Command `fg` (short for **f**ore**g**round) moves background job to the foreground, either the job specified or the one most recently added to the background if none specified. When the foreground job is paused (via `Ctrl`\+` Z`), then this command resumes that job.
Command `wait`
Command [`wait`](https://en.wikipedia.org/wiki/Wait_\(command\) "Wait (command)") pauses the interactive session until the specified background jobs complete or for all background jobs of the active shell if none specified.[\[6\]](https://en.wikipedia.org/wiki/Job_control_\(Unix\)#cite_note-6)
Command `bg`
Command `bg` (short for **b**ack**g**round) moves the paused foreground job to the background and resumes it.
Command `jobs`
Command `jobs` reports information about each background job including ID, command line and running status (stopped or running).
The [interprocess communication](https://en.wikipedia.org/wiki/Interprocess_communication "Interprocess communication") of job control is implemented via [signals](https://en.wikipedia.org/wiki/Signal_\(IPC\) "Signal (IPC)").
Typically, a shell maintains information about background jobs in a job table. When an [interactive session](https://en.wikipedia.org/wiki/Login_session "Login session") ends (i.e. user [logs out](https://en.wikipedia.org/wiki/Logout "Logout")), the shell sends signal [SIGHUP](https://en.wikipedia.org/wiki/SIGHUP "SIGHUP") to all jobs, and waits for the process groups to exit before terminating itself. Some shells provide a non-POSIX command [`disown`](https://en.wikipedia.org/wiki/Disown_\(Unix\) "Disown (Unix)") that removes a job from the job table. The process group becomes an [orphan](https://en.wikipedia.org/wiki/Orphan_process "Orphan process"). The shell will not send it SIGHUP, nor wait for it to terminate. This is one technique for enabling a process as a [daemon](https://en.wikipedia.org/wiki/Daemon_\(computing\) "Daemon (computing)") owned directly by the root process [init](https://en.wikipedia.org/wiki/Init "Init"). The POSIX command [`nohup`](https://en.wikipedia.org/wiki/Nohup "Nohup") provides an alternate way to prevent a job from being terminated by the shell.
Suspending the foreground job (via `Ctrl`\+`Z`) sends signal SIGTSTP (terminal stop) to the processes of the group. By default, this signal causes a process to pause so that the shell can resume. However, a process can ignore the signal. A process can also be paused via signal SIGSTOP (stop), which cannot be ignored.
When the user presses `Ctrl`\+`C`, the shell sends signal [SIGINT](https://en.wikipedia.org/wiki/SIGINT_\(POSIX\) "SIGINT (POSIX)") (interrupt) to each foreground job process, which defaults to terminating it, though a process can ignore the signal.
When a stopped job is resumed (via `bg` or `fg`), the shell redirects [Input/output](https://en.wikipedia.org/wiki/Input/output "Input/output") and resumes it by sending signal SIGCONT to it.
A background process that attempts to read from or write to its [controlling terminal](https://en.wikipedia.org/wiki/Controlling_terminal "Controlling terminal") is sent signal SIGTTIN (for input) or SIGTTOU (for output). These signals stop the process by default, but they may also be handled in other ways. Shells often override the default stop action of SIGTTOU so that background processes deliver their output to the controlling terminal by default.
In bash, the `kill` builtin (not `/bin/kill`) can signal jobs by ID as well as by process group ID. Sending a signal to a job sends it to each process of the group. `kill` can send any signal to a job; however, if the intent is to rid the system of the processes, the signals [SIGKILL](https://en.wikipedia.org/wiki/SIGKILL "SIGKILL") and [SIGTERM](https://en.wikipedia.org/wiki/SIGTERM "SIGTERM") (the default) are probably the most applicable.
1. **[^](https://en.wikipedia.org/wiki/Job_control_\(Unix\)#cite_ref-1)** IEEE Std 1003.1-2001, [Section 3.201, Job](http://pubs.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap03.html#tag_03_201) [Archived](https://web.archive.org/web/20190801165956/http://pubs.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap03.html#tag_03_201) 2019-08-01 at the [Wayback Machine](https://en.wikipedia.org/wiki/Wayback_Machine "Wayback Machine")
2. **[^](https://en.wikipedia.org/wiki/Job_control_\(Unix\)#cite_ref-2)**
Foreword by [Bill Joy](https://en.wikipedia.org/wiki/Bill_Joy "Bill Joy") in
Anderson, Gail; Paul Anderson (1986). [*The UNIX C Shell Field Guide*](https://archive.org/details/unixcshellfieldg00ande). Prentice-Hall. p. xvii. [ISBN](https://en.wikipedia.org/wiki/ISBN_\(identifier\) "ISBN (identifier)")
[0-13-937468-X](https://en.wikipedia.org/wiki/Special:BookSources/0-13-937468-X "Special:BookSources/0-13-937468-X")
.
3. **[^](https://en.wikipedia.org/wiki/Job_control_\(Unix\)#cite_ref-3)** IEEE Std 1003.1-2001, [Section 3.203, Job Control Job ID](http://www.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap03.html#tag_03_203) [Archived](https://web.archive.org/web/20101009060625/http://www.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap03.html#tag_03_203) 2010-10-09 at the [Wayback Machine](https://en.wikipedia.org/wiki/Wayback_Machine "Wayback Machine")
4. **[^](https://en.wikipedia.org/wiki/Job_control_\(Unix\)#cite_ref-4)**
["7.1 Job Control Basics"](https://www.gnu.org/software/bash/manual/html_node/Job-Control-Basics.html#Job-Control-Basics). [Archived](https://web.archive.org/web/20160802215912/http://www.gnu.org/software/bash/manual/html_node/Job-Control-Basics.html#Job-Control-Basics) from the original on 2016-08-02. Retrieved 2016-07-22.
5. **[^](https://en.wikipedia.org/wiki/Job_control_\(Unix\)#cite_ref-5)** `bg` – Shell and Utilities Reference, [The Single UNIX Specification](https://en.wikipedia.org/wiki/Single_Unix_Specification "Single Unix Specification"), Version 5 from [The Open Group](https://en.wikipedia.org/wiki/The_Open_Group "The Open Group"); `fg` – Shell and Utilities Reference, [The Single UNIX Specification](https://en.wikipedia.org/wiki/Single_Unix_Specification "Single Unix Specification"), Version 5 from [The Open Group](https://en.wikipedia.org/wiki/The_Open_Group "The Open Group").
6. **[^](https://en.wikipedia.org/wiki/Job_control_\(Unix\)#cite_ref-6)**
Kerrisk, Michael (Feb 2, 2025). ["wait(1p) — Linux manual page"](https://www.man7.org/linux/man-pages/man1/wait.1p.html). *man7.org*. [Archived](https://web.archive.org/web/20250516160332/https://www.man7.org/linux/man-pages/man1/wait.1p.html) from the original on May 16, 2025. Retrieved May 13, 2025.
- [Marshall Kirk McKusick](https://en.wikipedia.org/wiki/Marshall_Kirk_McKusick "Marshall Kirk McKusick") and George V. Neville-Neil (2004-08-02). ["FreeBSD Process Management: Process Groups and Sessions"](http://www.informit.com/articles/article.aspx?p=366888&seqNum=8). [*The Design and Implementation of the FreeBSD Operating System*](http://www.informit.com/title/0201702452). Addison Wesley. [ISBN](https://en.wikipedia.org/wiki/ISBN_\(identifier\) "ISBN (identifier)")
[0-201-70245-2](https://en.wikipedia.org/wiki/Special:BookSources/0-201-70245-2 "Special:BookSources/0-201-70245-2")
.
- "Job Control", [*Bash Reference Manual*](https://web.archive.org/web/20060523213233/http://cnswww.cns.cwru.edu/~chet/bash/bashref.html) |
| Shard | 152 (laksa) |
| Root Hash | 17790707453426894952 |
| Unparsed URL | org,wikipedia!en,/wiki/Job_control_(Unix) s443 |