UNIX Jobs and Processes
About Jobs
Jobs and processes are the "stuff" that you have running in the foreground and background. You can use the Unix jobs command to see what processes you have running and you can use the kill command to stop or terminate current processes. Also, you can type CTRL+Z to suspend a process. (Note that things in square brackets are optional flags.)
jobs [-p | -l] [-n] [-p] [-x] [job id] | |
---|---|
Switch | Description |
-p | -l | Report the process group ID and working directory of the jobs. |
-n | Display only jobs that have stopped or exited since last notified. |
-p | Displays only the process IDs for the process group leaders of the selected jobs. |
-x | Replace any job_id found in command or arguments with the corresponding process group ID, and then execute command passing it arguments. |
job id | By entering the job id you get information about only that job. If you type jobs without any parameters then you will get a list of all current jobs. |
kill [-s] [-l] %pid | |
---|---|
Switch | Description |
-s | Specify the signal to send, using one of the symbolic names defined in the <signal.h> description. Values of signal will be recognized in a case independent fashion, without the SIG prefix. In addition, the symbolic name 0 will be recognized, representing the signal value zero. The corresponding signal will be sent instead of SIGTERM. |
-l | Write all values of signal sup ported by the implementation, if no operand is given. If an exit_status operand is given and it is a value of the ? shell special parameter and wait corresponding to a process that was terminated by a signal, the signal corresponding to the signal that terminated the process will be written. If an exit_status operand is given and it is the unsigned decimal integer value of a signal number, the signal corresponding to that signal will be written. Otherwise, the results are unspecified. |
pid |
One of the following:
|
Examples
For example, say you entered man whitepages to see the manual entry for the whitepages command. While in the manual, you typed CTRL+Z to suspend the process and get back to the prompt. At the prompt you typed:
jobs
You would get a result like:
[1]+ Stopped man whitepages
In this example the id is 1 it has been stopped by the user and the process is man whitepages. You could then kill this process by typing:
kill %1
You would then get a result similar to this:
[1]+ Terminated man whitepages
And the process has been killed.
Maintained by itweb.Last modified: Mar 11, 2005, 20:11 UTC