Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

7
  • 4
    If you don't know the PID of the application you can use pkill to specify the name of the executable instead. For example: pkill -HUP firefox-bin Commented Aug 26, 2011 at 15:13
  • @Dave too: Interesting, I found this related which suggests a similar but reverted order: TERM->INT->HUP (mind the old age). Maybe I will keep HUP->INT->TERM in mind, as KILL doesn't seem to be friendly to me. Thanks to all. Commented Aug 29, 2011 at 9:03
  • @Caleb, just be careful there where there are multiple processes with the same name: pkill will kill them all. E.g., run this a few times to make some background processes: sed "s/Woo/woo/" < /dev/urandom >> /dev/null &. Then do pkill -HUP sed. You will kill all the instances of sed you started plus any other instances doing useful work. Commented Apr 7, 2015 at 11:54
  • 1
    @Caleb moreover, pkill will also kill some apps you don't expect to: e.g. if you have chromium running, and want to kill a program called rom, pkill will happily shoot chromium down. Better use killall, which will only match exact name (not on Solaris though, where it literally kills all processes). Commented Jan 5, 2018 at 15:53
  • @Ruslan Or use pkill -x to get an exact match instead of a partial match. I personally take advantage of the partial matching to save typing, but you have to know what the tool does. Yes, by default it matches partial strings. Another useful option is -f to match against the full command line instead of just $0. Commented Jan 5, 2018 at 15:57