2

Possible Duplicate:
Linux - How do I see when a process started?

ps -ef

shows the date that the process started. I'd like to see the date and the time if possible.

4 Answers 4

8
ps -eo pid,user,cmd,lstart

I think you want lstart, the time displayed with -eF is bsdstart which shows time in Month Day only if more than 24 hours ago.

0

You could use

ps -eF
1
  • ps -ef doesn't seem to show the time for processes that were not started today.
    – braveterry
    Mar 19, 2010 at 14:37
0

You can check the creation time of the process in /proc/, by looking at the creation time of the process's status file :

ls -lc /proc/<pid>/status

This gives you both the date and time.

0

You can use 'ps' or you can pull it from proc.

Additionally, /proc/$PID/stat has a field (either 10 or 22, I don't remember) which gives you a representation of start time from boot in jiffies. Edit.. Like someone else said, I had always thought the mtime of /proc/$PID/stat was a valid measure, but it doesn't seem to jibe:

[jeff@marvin 1]$ stat /proc/1/stat
  File: `/proc/1/stat'
  Size: 0           Blocks: 0          IO Block: 1024   regular empty file
Device: 3h/3d   Inode: 1661623     Links: 1
Access: (0444/-r--r--r--)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2010-03-15 16:31:16.391415019 -0400
Modify: 2010-03-15 16:31:16.391415019 -0400
Change: 2010-03-15 16:31:16.391415019 -0400

That gives me a start of March 15th, but ps -ef reports differently:

UID        PID  PPID  C STIME TTY          TIME CMD
root         1     0  0 Jan07 ?        00:00:02 /sbin/init

The ps command is most likely doing the jiffy math, and according to my uptime, it looks to be the most correct.

[jeff@marvin 1]$ uptime
 10:31:52 up 70 days, 17:22,  7 users,  load average: 0.00, 0.00, 0.00
[jeff@marvin 1]$ 

Not the answer you're looking for? Browse other questions tagged .