1
I issue the command ps -aux | grep tony
. It displays the following output
tony 10986 0.0 0.0 33532 464 ? S Feb01 0:00 vncconfig -iconic
tony 10988 0.0 0.0 86012 512 ? S Feb01 0:00 twm
tony 15553 0.0 0.0 92404 1848 ? S 10:34 0:00 sshd: tony@pts/34
tony 15554 0.0 0.0 66232 1680 pts/34 Ss+ 10:34 0:00 -bash
I would like kill all the my dead processes that have dates older than today.
I could have issued the command kill -9 10986
; kill -9 10988
, but I like to execute in one command and also there are many dead processes pending.
Any help would be much appreciated.
The question is how to write a shell program to do the processing; that is a question about programming, and is therefore on-topic for StackOverflow which is about programming - including shell programming. And even if the code is not written in shell (maybe Perl or Python instead), it is still about writing a program to do a job, and is therefore on-topic for StackOverflow. – Jonathan Leffler – 2011-02-11T03:25:27.503
Use
ps ux
orps -u tony
instead ofgrep
to avoid false positives. – Paused until further notice. – 2011-02-11T05:00:17.317Than today, or more than 24 hours old? – Mikel – 2011-02-11T05:12:23.680
@Dennis Yes, that is better - thanks for the suggestion – None – 2011-02-11T06:12:40.383