JOBS(1P)
π PROLOG π
Okay bestie, quick heads up before we dive in: this manual page is part of the POSIX Programmer's Manual. The Linux implementation of this interface may differ (so like, go check the corresponding Linux manual page for the Linux behavior if that's your situation), or the interface might not even be implemented on Linux at all. No cap. π
β¨ NAME β¨
jobs β display status of jobs in the current session π«Ά
This is JOBS(1P), from the POSIX Programmer's Manual, and it's lowkey one of the most useful little utilities in your whole shell, fr fr.
πΈ SYNOPSIS πΈ
jobs [-l|-p] [job_id...]
π DESCRIPTION π
The jobs utility shall display the status of jobs that were started in the current shell environment; see Section 2.12, Shell Execution Environment. π
When jobs reports the termination status of a job, the shell shall remove its process ID from the list of those "known in the current shell execution environment"; see Section 2.9.3.1, Examples.
π₯ OPTIONS π₯
The jobs utility shall conform to the Base Definitions volume of POSIX.1β2017, Section 12.2, Utility Syntax Guidelines.
The following options shall be supported:
-lβ (The letter ell, bestie, not a one.) Provide more information about each job listed. This information shall include the job number, current job, process group ID, state, and the command that formed the job. It's giving β¨full receiptsβ¨.-pβ Display only the process IDs for the process group leaders of the selected jobs. Just the numbers, nothing else. So minimal. So chic. π
By default, the jobs utility shall display the status of all stopped jobs, running background jobs and all jobs whose status has changed and have not been reported by the shell.
π¦ OPERANDS π¦
The following operand shall be supported:
job_idβ Specifies the jobs for which the status is to be displayed. If nojob_idis given, the status information for all jobs shall be displayed. The format ofjob_idis described in the Base Definitions volume of POSIX.1β2017, Section 3.204, Job Control Job ID.
π STDIN π
Not used. Nope. Nothing. She's not listening on stdin, bestie. π
π INPUT FILES π
None. Zero. Nada. π
π ENVIRONMENT VARIABLES π
The following environment variables shall affect the execution of jobs:
LANGβ Provide a default value for the internationalization variables that are unset or null. (See the Base Definitions volume of POSIX.1β2017, Section 8.2, Internationalization Variables for the precedence of internationalization variables used to determine the values of locale categories.)LC_ALLβ If set to a non-empty string value, override the values of all the other internationalization variables. She's the main character, she overrides everyone. πLC_CTYPEβ Determine the locale for the interpretation of sequences of bytes of text data as characters (for example, single-byte as opposed to multi-byte characters in arguments).LC_MESSAGESβ Determine the locale that should be used to affect the format and contents of diagnostic messages written to standard error and informative messages written to standard output.NLSPATHβ Determine the location of message catalogs for the processing ofLC_MESSAGES.
β ASYNCHRONOUS EVENTS β
Default. β¨
πΈ STDOUT πΈ
If the -p option is specified, the output shall consist of one line for each process ID:
"%d\n", <process ID>
Otherwise, if the -l option is not specified, the output shall be a series of lines of the form:
"[%d] %c %s %s\n", <job-number>, <current>, <state>, <command>
where the fields shall be as follows:
<current>β The character'+'identifies the job that would be used as a default for thefgorbgutilities; this job can also be specified using thejob_id%+or"%%". The character'-'identifies the job that would become the default if the current default job were to exit; this job can also be specified using thejob_id%-. For other jobs, this field is a<space>. At most one job can be identified with'+'and at most one job can be identified with'-'. If there is any suspended job, then the current job shall be a suspended job. If there are at least two suspended jobs, then the previous job also shall be a suspended job.<job-number>β A number that can be used to identify the process group to thewait,fg,bg, andkillutilities. Using these utilities, the job can be identified by prefixing the job number with'%'.<state>β One of the following strings (in the POSIX locale):Runningβ Indicates that the job has not been suspended by a signal and has not exited.Doneβ Indicates that the job completed and returned exit status zero.Done(code)β Indicates that the job completed normally and that it exited with the specified non-zero exit status,code, expressed as a decimal number.Stoppedβ Indicates that the job was suspended by theSIGTSTPsignal.Stopped (SIGTSTP)β Indicates that the job was suspended by theSIGTSTPsignal.Stopped (SIGSTOP)β Indicates that the job was suspended by theSIGSTOPsignal.Stopped (SIGTTIN)β Indicates that the job was suspended by theSIGTTINsignal.Stopped (SIGTTOU)β Indicates that the job was suspended by theSIGTTOUsignal.
The implementation may substitute the string Suspended in place of Stopped. If the job was terminated by a signal, the format of <state> is unspecified, but it shall be visibly distinct from all of the other <state> formats shown here and shall indicate the name or description of the signal causing the termination. (Translation: it's giving chaos, but like, organized chaos. π)
<command>β The associated command that was given to the shell.
If the -l option is specified, a field containing the process group ID shall be inserted before the <state> field. Also, more processes in a process group may be output on separate lines, using only the process ID and <command> fields.
π§ STDERR π§
The standard error shall be used only for diagnostic messages.
π OUTPUT FILES π
None. π
π EXTENDED DESCRIPTION π
None.
π₯ EXIT STATUS π₯
The following exit values shall be returned:
0β Successful completion. Slay. π>0β An error occurred. π
π CONSEQUENCES OF ERRORS π
Default.
The following sections are informative.
π«Ά APPLICATION USAGE π«Ά
The -p option is the only portable way to find out the process group of a job because different implementations have different strategies for defining the process group of the job. Usage such as $(jobs -p) provides a way of referring to the process group of the job in an implementation-independent way. Literally iconic. Memorize it. β¨
The jobs utility does not work as expected when it is operating in its own utility execution environment because that environment has no applicable jobs to manipulate. See the APPLICATION USAGE section for bg. For this reason, jobs is generally implemented as a shell regular built-in.
Bestie note: this is why jobs feels like it "just knows" your background stuff β it's a built-in, and built-ins share the shell's whole vibe. π
β EXAMPLES β
None.
π RATIONALE π
Both "%%" and "%+" are used to refer to the current job. Both forms are of equal validityβthe "%%" mirroring "$$" and "%+" mirroring the output of jobs. Both forms reflect historical practice of the KornShell and the C shell with job control.
The job control features provided by bg, fg, and jobs are based on the KornShell. The standard developers examined the characteristics of the C shell versions of these utilities and found that differences exist. Despite widespread use of the C shell, the KornShell versions were selected for this volume of POSIX.1β2017 to maintain a degree of uniformity with the rest of the KornShell features selected (such as the very popular command line editing features).
The jobs utility is not dependent on the job control option, as are the seemingly related bg and fg utilities because jobs is useful for examining background jobs, regardless of the condition of job control. When the user has invoked a set +m command and job control has been turned off, jobs can still be used to examine the background jobs associated with that current session. Similarly, kill can then be used to kill background jobs with kill %<background job number>.
The output for terminated jobs is left unspecified to accommodate various historical systems. The following formats have been witnessed:
Killed(signal name)signal namesignal name(coredump)signal description- core dumped
Most users should be able to understand these formats, although it means that applications have trouble parsing them. (Not the applications catching strays π)
The calculation of job IDs was not described since this would suggest an implementation, which may impose unnecessary restrictions.
In an early proposal, a -n option was included to "Display the status of jobs that have changed, exited, or stopped since the last status report". It was removed because the shell always writes any changed status of jobs before each prompt. Rip -n, you would've been fine but you were redundant. π―οΈ
π FUTURE DIRECTIONS π
None.
πΈ SEE ALSO πΈ
Section 2.12, Shell Execution Environment, bg, fg, kill, wait
The Base Definitions volume of POSIX.1β2017, Section 3.204, Job Control Job ID, Chapter 8, Environment Variables, Section 12.2, Utility Syntax Guidelines
π COPYRIGHT π
Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1-2017, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html .
Any typographical or formatting errors that appear in this page are most likely to have been introduced during the conversion of the source files to man page format. To report such errors, see https://www.kernel.org/doc/man-pages/reporting_bugs.html .
okay that's the whole thing, you ate that π«Ά go forth and jobs -l responsibly bestie π
this page was brought to you by IEEE/The Open Group, version/date 2017, and the title on the tin is JOBS(1P) β mwah, periodt. β¨
π¦ where this page comes from
- alpine 3.22: man-pages-posix 2017a-r0 Β· custom
- alpine 3.23: man-pages-posix 2017a-r0 Β· custom
- alpine 3.24: man-pages-posix 2017a-r0 Β· custom
- arch rolling: man-pages 6.19-1
- arch rolling: man-pages 6.20-1 Β· BSD-2-Clause AND BSD-3-Clause AND BSD-4.3TAHOE AND BSD-4-Clause-UC AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND LGPL-3.0-linking-exception AND LGPL-3.0-or-later AND LicenseRef-Public-Domain AND LicenseRef-UltraPermissive AND Linux-man-pages-1-para AND Linux-man-pages-copyleft AND Linux-man-pages-copyleft-2-para AND Linux-man-pages-copyleft-var AND MIT AND Spencer-94
- nixpkgs unstable: man-pages-posix 2017a
- opensuse-leap 16.0: man-pages-posix 2017a-160000.4.1 Β· SUSE-IEEE
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms