2019-03-31 09:05:09 +00:00
.. _cmd-jobs:
2018-12-17 01:39:33 +00:00
jobs - print currently running jobs
2019-01-03 04:10:47 +00:00
===================================
2018-12-17 01:39:33 +00:00
2018-12-18 01:58:24 +00:00
Synopsis
--------
2018-12-16 21:08:41 +00:00
2021-12-25 00:15:40 +00:00
`` jobs `` [*OPTIONS* ] [ *PID* | %*JOBID* ]
2018-12-18 01:58:24 +00:00
2018-12-16 21:08:41 +00:00
2018-12-19 02:44:30 +00:00
Description
2019-01-03 04:10:47 +00:00
-----------
2018-12-16 21:08:41 +00:00
2020-01-31 03:38:56 +00:00
`` jobs `` prints a list of the currently running :ref: `jobs <syntax-job-control>` and their status.
2018-12-16 21:08:41 +00:00
jobs accepts the following switches:
2018-12-19 20:02:45 +00:00
- `` -c `` or `` --command `` prints the command name for each process in jobs.
2018-12-16 21:08:41 +00:00
2018-12-19 20:02:45 +00:00
- `` -g `` or `` --group `` only prints the group ID of each job.
2018-12-16 21:08:41 +00:00
2018-12-19 20:02:45 +00:00
- `` -l `` or `` --last `` prints only the last job to be started.
2018-12-16 21:08:41 +00:00
2018-12-19 20:02:45 +00:00
- `` -p `` or `` --pid `` prints the process ID for each process in all jobs.
2018-12-16 21:08:41 +00:00
2020-09-04 14:41:34 +00:00
- `` -q `` or `` --query `` prints no output for evaluation of jobs by exit status only. For compatibility with old fish versions this is also `` --quiet `` (but this is deprecated).
2018-12-16 21:08:41 +00:00
On systems that supports this feature, jobs will print the CPU usage of each job since the last command was executed. The CPU usage is expressed as a percentage of full CPU activity. Note that on multiprocessor systems, the total activity may be more than 100\%.
2021-02-28 12:56:23 +00:00
Arguments of the form `` PID `` or `` %JOBID `` restrict the output to jobs with the selected process identifiers or job numbers respectively.
2020-07-02 21:46:54 +00:00
If the output of `` jobs `` is redirected or if it is part of a command substitution, the column header that is usually printed is omitted, making it easier to parse.
2020-03-21 14:31:25 +00:00
The exit status of `` jobs `` is `` 0 `` if there are running background jobs and `` 1 `` otherwise.
2018-12-16 21:08:41 +00:00
2018-12-19 02:44:30 +00:00
Example
2019-01-03 04:10:47 +00:00
-------
2018-12-16 21:08:41 +00:00
2020-07-06 12:48:13 +00:00
`` jobs `` outputs a summary of the current jobs, such as two long-running tasks in this example:
.. code-block :: none
Job Group State Command
2 26012 running nc -l 55232 < /dev/random &
1 26011 running python tests/test_11.py &