Subscribe to How-To Geek

Kill a Process by Process Name from Ubuntu Command Line

There are a number of ways to kill a process if you know the name of the process. Here’s a couple different ways you can accomplish this. We are going to assume that the process we are trying to kill is named irssi

kill $(pgrep irssi)

killall -v irssi

pkill irssi

kill `ps -ef | grep irssi | grep -v grep | awk ‘{print $2}’`

These techniques can be useful in shell scripts, where you wouldn’t know the process ID and would need to restart or kill a process.

| More
This article was originally written on 09/25/06 Tagged with: Shell Scripts, SysAdmin, Ubuntu

Daily Email Updates

You can get our how-to articles in your inbox each day for free. Just enter your name and email below:


Name:
Email:

Comments (8)

  1. sven

    ps -ef | grep irssi | grep -v grep | xargs kill
    would work too

  2. Nicholas

    I just use this: killall (program name). Works fine for me.

  3. Mahmut

    Thanks Nicholas. It is working

  4. Kar.ma

    Thank you! My wine was crashing, and my gnome-system-monitor couldn’t close it (under Ubuntu 8.10). I could close it with
    killall -v wineserver

    My CPU was quickly raising temperature, so thank you for this helpful simple short guide!

  5. Matthew Glennon

    Perfect! Just what i was looking for.

    Thanks!

  6. tryntobegeek

    Thanks for helping this newbie out.

  7. sameer

    i am wondering whether a kill command can be piped ot not

    i tried the command
    ps | grep hbuild_topic | cut -c-6 | kill to kill all the process with the name hbuild_topic i wasnt able to kill the process

  8. Anotherone

    or ps aux | grep irssi | grep -v grep | awk ‘{print$2}’ | xargs kill -9


Leave a Comment




Leave your friendly comment here.

If you have a computer help question, click here to leave it on the forums instead.

Note: Your comment may not show up immediately on the site.

Our Friends
Getting Started


About How-To Geek
What Is That Process?
svchost.exe
jusched.exe
dwm.exe
ctfmon.exe
wmpnetwk.exe
wmpnscfg.exe
rundll32.exe
wfcrun32.exe
Ipoint.exe
Itype.exe
Wfica32.exe
Mobsync.exe
conhost.exe
Dpupdchk.exe Adobe_Updater.exe

Copyright © 2006-2009 HowToGeek.com. All Rights Reserved.