- 3,129 hits
Place for playing with commands…
ODOC: About kill command
The kill command can Cancels a job.
kill [-s] [-l] %pid
-s -> Specify the signal to send, using one of the symbolic names defined in the 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 ter minated 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:
1. A decimal integer specifying a process or process group to be signaled. The process or processes selected by positive, negative and zero values of the pid operand will be as
described for the kill function. If process number 0 is specified, all processes in the process group are signaled. If the first pid operand is negative, it should be preceded by — to keep it from being interpreted as an option.
2. A job control job ID that identifies a background process group to be signaled. The job control job ID notation is applicable only for invocations of kill in the current shell execution environment.
Note the job control job ID pid is available only on systems supporting the job control option.
praveen@praveen-desktop:~$ kill -s kill 100 -165
Kills job 1 of uid 165
When running the kill command you may receive the error “Operation not permitted”, this is often encountered when you’re killing the wrong group id (often 1,2,3 or low number jobs) that you don’t have permission to kill. If you wish to see the group id of the background task run jobs -l