Tech Reflect
  • Home
  • About This Site
  • Contact me
  • Search Icon
More efficient process killing

More efficient process killing

2017-04-11

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 signal, choosing from a list of possible signals. Here’s how it looks.

Related Posts:

  • Old Dock tips that are still useful
    Old Dock tips that are still useful
  • Ultra high volume email workflow
    Ultra high volume email workflow
  • Why is my own data least important in search?
    Why is my own data least important in search?

geeky, macOS tips

Post navigation

NEXT
Sharing shell settings between Macs
PREVIOUS
Save time in System Preferences

Get Monthly Updates

Recent Posts

  • Flower Power and Blue Dalmatian to the rescue?
  • “Why does Mail have to be so fucking complicated?”
  • This mouse has no tail!
  • Interview feedback and the Thumb-o-meter™
  • Buy a cactus, get hired

Categories

  • analog (1)
  • apple career (11)
  • apple inside (11)
  • apple stories (17)
  • bertrand serlet (3)
  • essays (15)
  • geeky (21)
  • interviews (4)
  • iOS tips (3)
  • Mac OS X (2)
  • macOS tips (37)
  • personal (7)
  • products (4)
  • scott forstall (7)
  • scripting (1)
  • steve jobs (14)
  • tim cook (1)
  • workplace (14)

Get Monthly Updates

About cricket


Me with Guiness the owl

25 years in tech. I like to write manifestos. I like to offer interesting tips. I like making fun of things. Everyone copes differently.

My Other Blogs

  • Free Range Parrots
  • Plucky Tree (personal)
© 2022   All Rights Reserved.