Untitled Document
kill Command

kill command is used to terminate one or more processes . The kill command sends a signal , usually with the intention of killing one or more processes. The command uses one or more PIDs as its argument and by Default uses the SIGTERM ( 15 ) signal .

Example 1 -

Below command terminates the job having PID 4115

  kill 4115 

Example 2 - killing multiple jobs

If you run more than one job - either in background or in current login shell , you can kill them all with a single kill command . Just specify all their PIDs with kill

  kill 4412 3897 4328 4332 4355

Example 3 - use kill with other signals

By default kill , uses the SIGTERM signal ( 15 ) to terminate the process. You would have notice that some programs simply ignores it and continue execution normally. In that case , the process can be killed with the SIGKILL ( 9) .

  kill -9 4358
If you have too many jobs to kill and if all these processes have the same parent , you may simply kill the parent in order to kill all its children .

Example 4 - kill your login shell

A simple kill command ( with TERM ) won't kill the login shell . You can kill your login shell by using any of these commands .

  kill -9 $$ OR
kill -s KILL 0
To view the list of all signal names and numbers that are available on your machine , use the command kill -l ( list ) .
Untitled Document