Tech Reflect

Tech Reflect

Share this post

Tech Reflect
Tech Reflect
More efficient process killing

More efficient process killing

Chris Hynes - cricket's avatar
Chris Hynes - cricket
Apr 11, 2017
∙ Paid

Share this post

Tech Reflect
Tech Reflect
More efficient process killing
Share

When people want to kill processes from the command line, I typically see them:

  • Run the ps command, with or without flags, and with or without grep

  • Sift through the results if there is more that one

  • Grab the pid and run “kill <pid>“

  • Repeat the steps to kill other similar processes

There are a few other commands that are more sophisticated than kill and will save you time.

killall

# kill all processes with that name (so you don't need the PID)
killall <exact process name>

# kill all processes that match a regex
killall -m <expression>

# Test the command ahead of time rather than running it
killall -s 

pkill (and pgrep)

# show all processes that match the expression
pgrep <expression>

# kill processes that match
pkill <expression>

# match full argument lists, so you could kill processes within a specific folder hierarchy, for example
pkill -f  <expression>

Activity Monitor, duh

Save some headache and try Activity Monitor. You can search and sort a process list easily, kill a process, or send a…

Keep reading with a 7-day free trial

Subscribe to Tech Reflect to keep reading this post and get 7 days of free access to the full post archives.

Already a paid subscriber? Sign in
© 2025 Christopher Hynes
Privacy ∙ Terms ∙ Collection notice
Start writingGet the app
Substack is the home for great culture

Share