0

I need to get the date when a particular process was started by PID.

For this purpose, I use:

stat -c %y /proc/PID

In the output, I get the date in the following format:

2021-07-04 11:00:20.352976946 +0300'

But I need it in seconds since the epoch.

Is it possible somehow?

Thanks

1
  • 1
    Do you know about the on-system documentation? man stat for example
    – roaima
    Jul 14 at 12:22
5

You can use %Y instead of %y.

stat -c %Y /proc/28
1626244631

From man stat:

%Y time of last data modification, seconds since Epoch

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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