I'm Looking for a way to show the time a certain process is in it's current state.
At the moment, I'm using the command:
ps -A -o uname,pid,state,etime,cmd | grep -e pbs | egrep -v "grep"
Which give me output like this:
root 1613 S 4-00:16:59 /usr/sbin/pbs_server root 13508 S 1-18:13:37 /usr/sbin/pbs_sched root 15344 R 01:09:51 /usr/sbin/pbs_mom
This tells me
pbs_mom is running for approx one hour. However, I need to know for how long it has this running state. Is there a way to get this using only the command-line? (since I'm intending to use it in a script)