≡ Menu

Kill Process In Ubuntu Linux

How can I kill a process using the bash command prompt? Do I always need to kill the process using PID?

To kill processes by name use the killall command. The syntax is as follows:

killall -SIGNAME process-name

The default signal for kill is TERM (terminate process). To list available signals, enter:
$ kill -l
The following are useful signals and used frequently by sys admins and Ubuntu users:

  1. SIGHUP (1) – Hangup detected on controlling terminal or death of controlling process.
  2. SIGINT (2) – Interrupt from keyboard.
  3. SIGKILL (9) – Kill signal i.e. kill running process.
  4. SIGSTOP (19) – Stop process.
  5. SIGCONT (18) – Continue process if stopped.

Examples – Ubuntu Linux: Killing Process

To kill all apache2 process, enter:
$ sudo killall -9 apache2
To kill all firefox process, enter:
$ sudo killall -9 firefox-bin
You can also use the pkill command as follows to kill all php-cgi process, enter:
$ pkill -KILL php-cgi
The -u option will kill only processes whose effective user ID is set to vivek:
$ sudo pkill -KILL -u vivek php-cgi

See also:

Sysadmin because even developers need heroes!!!

Share this tutorial on:
{ 4 comments… add one }
  • zzeroo December 16, 2010, 8:23 pm

    If you have a process name you can kill them via:

    # killall PROCESSNAME

    even better is the program pkill

    # pkill PROCESSNAME

    This kill all processes named PROCESSNAME.

  • Vladimir December 18, 2010, 7:51 pm

    kill -SIGKILL `pidof process-name`

  • Sourav April 7, 2012, 7:49 pm

    The last one worked for me

    Thank you Vladimir

  • Mutapa May 8, 2013, 4:14 pm

    Thanks a million. acroread was killing my machine and the killall -9 acroread did the trick. I can now work.

Security: Are you a robot or human?

Leave a Comment

You can use these HTML tags and attributes: <strong> <em> <pre> <code> <a href="" title="">


   Tagged with: , , , , , , , , , , , , ,