jobs
From Mac Guides
This article is about the terminal command jobs. You may be looking for Steve Jobs
jobs is a Terminal command used to view the currently running background processes in the given shell. This tool, and it's related commands, provide a very handy way to manage large operations (such as compressing a large file) without taking over the shell.
Contents |
Controlling Jobs
There are a few commands used in controlling jobs in the shell.
Starting a Background Job
Time-intensive commands are sent to the background by postfixing the command with an ampersand(&). Jobs are sequentially numbered starting with 1.
Pausing a Foreground Job
Currently executing, non-background, tasks may be paused and sent to the background. Type ctrl-Z and the running process will pause, and be assigned a background job ID. To unpause, use the command fg.
Sending a Foreground Job to the Background
Type ctrl-Z to pause the job. Type bg to send it to the background.
Bringing a Background Job to the Foreground
Get a list of jobs with the jobs command. To bring a particular job to the foreground, type fg %1, where "1" in this example is the job ID, which is displayed in brackets.
Examples
To compress a large file in the background, an
gzip /Users/markyoung/Music/iTunes/iTunes\ Music\ Library.xml & jobs
Backgrounding a running job
gzip /Users/markyoung/Music/iTunes/iTunes\ Music\ Library.xml <ctrl-Z> bg %1 jobs
Stopping a background job whose job ID (not process iD) is 1.
jobs kill %1
Bringing a background job to the foreground
gzip /Users/markyoung/Music/iTunes/iTunes\ Music\ Library.xml & jobs fg %1

