jump to navigation

How to kill processes on Linux with “kill” and “killall” February 2, 2011

Posted by Tournas Dimitrios in Linux.

On Linux there are plenty of ways  to get rid of an application that refuses to listen to the File  > Exit or File > Quit or that handy X button in the upper right corner . When you’ve exhausted all of your options, there is always the command line. Windows users are also very familiar with the “ctl+alt+del” functionality, but we are passionate Linux users right ?

For taking care of ” stubborn ” Linux applications, there are two very helpful commands: kill and killall. But how are they used? Are they complicated or are they simple? Let’s examine these two very handy commands (they are installed by default on all Linux distributions ) .

killall is a tool for ending running processes on your system based on name. In contrast, kill terminates processes based on process ID number or “PID.” kill and killall can also send specific system signals to processes. Use killall and kill in conjunction with tools including ps to manage processes and end processes that have become stuck or unresponsive when necessary.

That’s all the theory for these commands , let’s get directly to practical examples ..

Important notes

  • Botht commands can take extra arguments :
    from terminal run kill -l

    Each argument is represented by a keyword with an asociated number , you can use the number or the keyword .
    kill -9  [PID]
    kill -s kill [PID]
    kill -kill  [PID]
  • Use ps aux  to find out the PID or the process name
    ps aux |grep -i "process" 


  • Use the "jobs" command to display all procecess that where started from the terminal and  placed in background with the "&" symbol .


Practical examples
killall -9 firefox-bin The obvious problem with this is you must know the exact name of the process you want to kill. So if you don’t know the name you can go back ps aux|grep firefox to get the exact name of the process.
kill  [PID] The kill command terminates individual processes as specified by their process ID numbers or “PIDs.”
This sends “SIGTERM” to the PID specified .You may specify multiple PIDs on the command line to terminate processes with “kill
  • kill -s KILL [PID]
  • kill -KILL  [PID] .
You may also send alternate system signals with kill. These  examples all send the “SIGKILL” signal to the PID specified .
  • killall -KILL [process name]
  • killall -SIGKILL [process name]
  • killall -9 [process name]
These  group of commands are equivalent.
killall -w irssi The “-w” option to the killall command causes killall to wait until the process terminates before exiting. Consider the following command .This command issues the “SIGTERM” system signal to the process with a name that matches “irssi“.“killall“ will wait until the matched processes have ended. If no process matches the name specified, killall returns an error message, as below:
  • kill  -l
  • killall -l
Issue one of the following commands to get a list of all of the available signals


Alternative solutions :

  • The terminal based ” top ” command
  • The gnome Gui based app :  gnome-system-monitor


No comments yet — be the first.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s