Thursday, May 5, 2011

cygwin: killing inactive sessions from ps

Its probably not the shortest oneliner however it does the job in CYGWIN.
$ ps -a | grep '^I' | perl -pe '@x=split;print $x[1],"\n";$_=undef'| xargs -i{}
 -t kill -9 {}