OSX Application Closer (Kill -9 Everything)
So this isn’t really security related but I find that OSX is really slow at closing everything when it needs to shutdown. I guess it does light closing procedures for applications that need saving etc… obviously this is a good thing, but sometimes I just want my stuff to close because I typically save things when they should be saved and don’t save things that shouldn’t be saved (just took some notes at some point or what have you). So I just wrote this one line for the terminal that will force close all of the currently open applications:
> sudo ps -Al | grep Applications | perl -e 'while(<STDIN>){chomp; ($uid, $pid) = split(" "); system("kill -9 $pid");}'
It just gets the list of running processes with ps, greps all of the PIDs that are associated with things running in the /Applications directory and kills them all with a small line of perl! Oh how I looove piping :)
I’m guessing I won’t need this when my new shiny SSD comes in the mail today ;)
Anyways, thanks for reading!
~Josh