PS -ef ??


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers PS -ef ??
# 8  
Old 12-28-2011
Did you actually type:
Quote:
ps -ef
Or something else?

Still a bit mystified why your "ps" does not output time as hh:mm:ss .
# 9  
Old 12-28-2011
... and the sample complete output lines?
# 10  
Old 12-28-2011
I sent them to you privately.
# 11  
Old 12-28-2011
Quote:
Originally Posted by methyl
Btw. The "grep" from rbatte1 works on my system.
My flavour of ps (procps version 3.2.7) when run as ps -ef includes the total time that the process has used, so all output lines match the grep pattern.

Maybe:
Code:
ps -ef| egrep -v "Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec"

This depends on the version of ps shifting the date in place of the time and when it does that; it might not be precise. I note on my system, processes that were started less than 24 hours ago, show Dec27 (rolls at midnight?), so if you really need all processes started in the last 24 hours you might turn to something like this:

Code:
find /proc -mtime -1 -name exe  2>/dev/null|grep -v /task/|xargs ls -l|awk '
{split( $(NF-2), a, "/"); printf( "%-10s %7s %s %s %s %s\n", $3, a[3], $6, $7, $8, $NF); }'

This is a real hack, and probably won't work on every system (certainly needs the proc file system to be functional), but it does present every process that was started during the past 24 hours (using the time that you run this command pipeline) and not just since midnight which is what you'll get if you depend on filtering away things like Dec21.

---------- Post updated at 11:17 ---------- Previous update was at 11:15 ----------

A bit of a sample ps output from my environment:

Code:
spot:[/home/scooter]ps -ef|head -14
UID        PID  PPID  C STIME TTY          TIME CMD
root         1     0  0 Dec19 ?        00:00:06 init [5]  
root         2     0  0 Dec19 ?        00:00:00 [kthreadd]
root         3     2  0 Dec19 ?        00:00:11 [migration/0]
root         4     2  0 Dec19 ?        00:00:32 [ksoftirqd/0]
root         5     2  0 Dec19 ?        00:00:03 [migration/1]
root         6     2  0 Dec19 ?        00:00:16 [ksoftirqd/1]
root         7     2  0 Dec19 ?        00:00:53 [events/0]
root         8     2  0 Dec19 ?        00:00:32 [events/1]
root         9     2  0 Dec19 ?        00:00:00 [khelper]
root        10     2  0 Dec19 ?        00:00:00 [kintegrityd/0]
root        11     2  0 Dec19 ?        00:00:00 [kintegrityd/1]
root        12     2  0 Dec19 ?        00:00:00 [kblockd/0]
root        13     2  0 Dec19 ?        00:00:00 [kblockd/1]

# 12  
Old 12-28-2011
Agama- The first command worked!! Thank you so much!!
# 13  
Old 12-28-2011
Clearly the output format from this GNU/Linux version of "ps" is different from the default unix output format.
Actually not having a space character between Month and Day is so much better ! (It's a pain in unix).

Just for completeness it would be nice to see a sample for processes started today.
# 14  
Old 12-28-2011
I can't say that a huge long grep -v is really the best way to approach this given that you may inadvertently match so many things, but then if it works, then I suppose that's all we all want.




Robin
 
Login or Register to Ask a Question

Previous Thread | Next Thread
Login or Register to Ask a Question