Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question

marked as duplicate by splattne Mar 19 '10 at 16:53

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

add comment

4 Answers

up vote 7 down vote accepted
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.

share|improve this answer
add comment

You could use

ps -eF
share|improve this answer
    
ps -ef doesn't seem to show the time for processes that were not started today. –  braveterry Mar 19 '10 at 14:37
add comment

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.

share|improve this answer
add comment

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]$ 
share|improve this answer
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.