![](https://techreflect.org/wp-content/uploads/2020/12/Mac_terminal_icon-1.png)
More efficient process killing
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.
![](https://techreflect.net/wp-content/uploads/2019/04/centipede-2019-04-16-at-5.04.53-PM-1024x628.png)
![](https://techreflect.net/wp-content/uploads/2019/04/centipede-2019-04-16-at-5.04.50-PM-567x1024.png)
![](https://techreflect.net/wp-content/uploads/2019/04/centipede-2019-04-16-at-5.05.11-PM.png)
![](https://techreflect.net/wp-content/uploads/2019/04/centipede-2019-04-16-at-5.05.27-PM.png)