Linux - How do I see when a process started?
shows the date that the process started. I'd like to see the date and the time if possible.
Server Fault is a question and answer site for system and network administrators. It only takes a minute to sign up.Sign up to join this community
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
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]$