How to find out how long a process has been running (elapsed time)
local carpet cleaners . shuttle express . mary green . Ever wondered how long a process has been running? Did you know how to find it? Well, it’s actually quite simple and can be done with the following command:
ps aux | grep amarokapp | grep -v grep | ps -o etime `awk ‘{ print $2 }’`
Above gives: ps aux | grep amarokapp | grep -v grep | ps -o etime `awk ‘{ print $2 }’`ELAPSED25:22In the case you have multiple commands running with the grep’ed name, you may want to list a bit more information:
ps aux | grep amarok | grep -v grep | ps -o pid,etime,cmd `awk ‘{ print $2 }’`
Above gives: $ps aux | grep amarok | grep -v grep | ps -o pid,etime,cmd `awk ‘{ print $2 }’`PID ELAPSED CMD10825 24:00 amarokapp10840 23:54 ruby /opt/kde3/share/apps/amarok/scripts/score_default/score_default.rbRemember you can pick what options you want in ps.. to find the options run:
man ps




You can do it in even a simpler way by using pidof:
> ps -o pid,etime,cmd `pidof amarok`
PID ELAPSED CMD
15569 03:24:57 /usr/bin/amarok
Normally I find this type of information dull and boring, but you turned that all around for me. This article takes you right in and won’t let go until you’re done reading the whole thing.
You make valid points in your article, many of which I agree with. Some I will have contemplate. That just means you made me think.
This type of content is normally dull and boring to me, but you have managed to make it very interesting. This is not boring information.