2019-03-31 17:05:09 +08:00
.. _cmd-jobs:
2018-12-17 09:39:33 +08:00
jobs - print currently running jobs
2019-01-03 12:10:47 +08:00
===================================
2018-12-17 09:39:33 +08:00
2018-12-18 09:58:24 +08:00
Synopsis
--------
2018-12-17 05:08:41 +08:00
2022-01-09 17:00:47 +08:00
`` jobs `` [*OPTIONS* ] [*PID* | %*JOBID* ]
2018-12-18 09:58:24 +08:00
2018-12-17 05:08:41 +08:00
2018-12-19 10:44:30 +08:00
Description
2019-01-03 12:10:47 +08:00
-----------
2018-12-17 05:08:41 +08:00
2020-01-31 11:38:56 +08:00
`` jobs `` prints a list of the currently running :ref: `jobs <syntax-job-control>` and their status.
2018-12-17 05:08:41 +08:00
jobs accepts the following switches:
2018-12-20 04:02:45 +08:00
- `` -c `` or `` --command `` prints the command name for each process in jobs.
2018-12-17 05:08:41 +08:00
2018-12-20 04:02:45 +08:00
- `` -g `` or `` --group `` only prints the group ID of each job.
2018-12-17 05:08:41 +08:00
2018-12-20 04:02:45 +08:00
- `` -l `` or `` --last `` prints only the last job to be started.
2018-12-17 05:08:41 +08:00
2018-12-20 04:02:45 +08:00
- `` -p `` or `` --pid `` prints the process ID for each process in all jobs.
2018-12-17 05:08:41 +08:00
2020-09-04 22:41:34 +08: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-17 05:08:41 +08: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 20:56:23 +08:00
Arguments of the form `` PID `` or `` %JOBID `` restrict the output to jobs with the selected process identifiers or job numbers respectively.
2020-07-03 05:46:54 +08: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 22:31:25 +08:00
The exit status of `` jobs `` is `` 0 `` if there are running background jobs and `` 1 `` otherwise.
2018-12-17 05:08:41 +08:00
2018-12-19 10:44:30 +08:00
Example
2019-01-03 12:10:47 +08:00
-------
2018-12-17 05:08:41 +08:00
2020-07-06 20:48:13 +08: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 &