Sooner or later you will find that an errant process is running amok or in the background and it needs to be stopped. This is called killing a process in Linux.
The most common command to kill a process is
$ kill 1234
kill sends the
$ kill 1234 5678 9999
TERMcan be sent to processes. To list all the available signal numbers and their corresponding signal names:
$ kill -L
$ kill -KILL 1234
$ kill -SIGKILL 1234
$ kill -9 1234
TERMis enough. Most processes receive this signal, clean up their work and exit. For errant processes which do not respond to
TERM, the final deathblow is sending a
KILL. On sending this signal, the kernel steps in and it directly murders the process giving it no chance to clean up.
Looking up the PID of a process and then killing it is usually cumbersome. What you usually want to do is to kill based on the process name. This can be done using the
$ killall vim
$ killall -r "*abcd*"
killall sends the
TERM signal. Other signals can be sent using signal number or signal name using the same command syntax as the
kill command shown above.
killall only prints out the processes that it could not kill. It might be better to also see output from the command when it succeeds. The verbose option can be used for this:
$ killall -v vim Killed vim(28952) with signal 15 Killed vim(28347) with signal 15
$ kill -i vim Kill vim(1067) ? (y/N)
Tried with: Ubuntu 14.04