Try using the pgrep / pkill combo.
- Tune your search with
pgrep
first. I'll nuke Firefox here.
pgrep -lafi firefox
(truncating with | head | cut -c-50
):
34536 /Applications/Firefox.app/Contents/MacOS/fir
34539 /Applications/Firefox.app/Contents/MacOS/plu
34540 /Applications/Firefox.app/Contents/MacOS/plu
34541 /Applications/Firefox.app/Contents/MacOS/plu
34544 /Applications/Firefox.app/Contents/MacOS/plu
34549 /Applications/Firefox.app/Contents/MacOS/plu
34550 /Applications/Firefox.app/Contents/MacOS/plu
34551 /Applications/Firefox.app/Contents/MacOS/plu
34557 /Applications/Firefox.app/Contents/MacOS/plu
34583 /Applications/Firefox.app/Contents/MacOS/plu
- just switch to
pkill
, keeping same arguments:
(Kinda like doing ls <complicated patter>
before running rm <complicated pattern>
)
pkill -lafi firefox
(this was a different run which is why the PIDs differ)
kill -15 390
kill -15 509
kill -15 671
kill -15 25256
kill -15 25265
kill -15 25296
kill -15 25303
kill -15 25309
kill -15 26301
kill -15 26306
kill -15 26307
kill -15 26308
kill -15 34489
kill -15 41143
kill -15 41498
kill -15 50615
kill -15 97395
pkill takes extra stuff too: pkill -9
p.s. re. a comment: As to why someone's workflow would prefer command line over Force Quit? Their business, init? Many people are more productive on shells. Doesn't have to be a malfunction either: in my case, it might be an npm run watch
server daemon that I want to launch to test, and then kill. And that puppy doesn't show up on F Q.
kill
?kill -9
them all. To do that without the FQ menu I'd have to find all those processes myself, and I might leave some process behind.kill
is a lot more manageable once you know aboutpgrep -lafi
and its close cousin,pkill
. They're not as clean as Force Quit, but get you most of the way.tell my.app to quit
well (it hangs), and I have to force quit it.