How to determine when process was started

by Milosz Galazka on October 31, 2016

There are at least several ways to determine when the process was started to help you investigate and trace potential issues. I will briefly introduce four different methods so you can choose to adapt and extend most useful one.

The first method is to print the last modification time of the process directory inside proc filesystem.

$ stat --printf="%y\n" /proc/2326
2016-10-06 08:21:42.451264052 +0000

The second method is to print time the command started using ps utility.

$ ps -p 2326 -o lstart=
Thu Oct 6 08:21:42 2016

The third method is to use seconds that elapsed since the process started to calculate time the command started.