Bash: List and kill a process


To list the processes you're running in the current terminal, type "ps".

Figure out which processes from the list you want to kill and select the process IDs (PIDs).

wnguyen@europa:~$ ps
  PID TTY          TIME CMD
22452 pts/16   00:00:00 bash
18595 pts/16   00:00:00 vim
18596 pts/16   00:00:00 vim
20490 pts/16   00:00:00 ps

wnguyen@europa:~$ kill -9 18595 18596

That will kill off both vim processes. Type ps again to make sure they're dead.

Dead like this.


  1. Love the site, thanks for putting it up public!

    A tip I found when I accidentally created a huge amount of processes while trying to script something... I had about 200+ processes that kicked off. Lucky I was in an SSH session, I could use the console to kill them all using this:

    kill -9 {2401..5000}

    Since they were in sequence that works. Also works for lots of other things too!

  2. Not a problem Anon.

    Hey thats pretty neat! Thanks!


Leave your thoughts ...
If you are having trouble with copy/pasting in comments, you need to sign in or click 'Preview'. For more information about this Firefox bug, see here.

Copyright © Twig's Tech Tips
Theme by BloggerThemes & TopWPThemes Sponsored by iBlogtoBlog