Linux - How do I see when a process started?

Solution 1:

If you want only the start time, you can select the field and suppress the header by doing this:

 ps -p YOURPID -o lstart=

the output will look like this:

 Mon Dec 14 17:17:16 2009

which is ctime(3) format and you can parse it to split out the relevant parts.

Other start fields such as start, stime, bsdstart and start_time age the time (after 24 hours only the date is shown, for example).

You can, however, use them directly for recently started processes without further parsing:

ps -p YOURPID -o stime=

which would output something like:


Solution 2:

awk '{print $22}' /proc/$pid/stat - gives you the start time in jiffies after boot

Solution 3:

"ps -f" - it's in the man pages