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.


geeky, macOS tips

Post navigation

NEXT
Sharing shell settings between Macs
PREVIOUS
Doing something with the “find” command
Comments are closed.

Get Monthly Updates

Recent Posts

  • Inserting random email sigs in Mail on iOS
  • Keep Instagram open to finish posting…
  • How I predicted the rise of Twitter, barely used it, and amassed 35,000 followers
  • Apple Books 2022, in pictures
  • Killing one bird with two-and-a-half stones in Mac OS X Mail

Categories

  • analog (1)
  • apple career (12)
  • apple inside (19)
  • apple stories (20)
  • bertrand serlet (3)
  • bugs (3)
  • essays (15)
  • geeky (21)
  • interviews (4)
  • iOS tips (4)
  • Mac OS X (7)
  • macOS tips (36)
  • personal (8)
  • predictions (1)
  • products (5)
  • prototypes (6)
  • scott forstall (7)
  • scripting (2)
  • siri (2)
  • steve jobs (16)
  • tim cook (1)
  • workplace (15)

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)
© 2025   All Rights Reserved.