Discovering a process run in the past

LuckyLuke93

New Member
Joined
Aug 31, 2022
Messages
5
Reaction score
0
Credits
53
Suppose that a random process starts at time X and ends at time X + 5 seconds... Is there a way to discover the TID, PID, and name of process for instance at time X+6 seconds? I would like to get the same informations given by ps
 


On Linux with the ps from procps(-ng) (and most other systems since this is specified by POSIX):

Code:
ps -o etime= -p "$$"

Where $$ is the PID of the process you want to check. This will return the elapsed time in the format [[dd-]hh:]mm:ss.

Or, with newer versions of the procps-ng tool suite (3.3.0 or above) on Linux or on FreeBSD 9.0 or above (and possibly others), use:

Code:
ps -o etimes= -p "$$"

Have a look here - https://www.ibm.com/docs/en/aix/7.1?topic=p-ps-command
 
On Linux with the ps from procps(-ng) (and most other systems since this is specified by POSIX):

Code:
ps -o etime= -p "$$"

Where $$ is the PID of the process you want to check. This will return the elapsed time in the format [[dd-]hh:]mm:ss.

Or, with newer versions of the procps-ng tool suite (3.3.0 or above) on Linux or on FreeBSD 9.0 or above (and possibly others), use:

Code:
ps -o etimes= -p "$$"

Have a look here - https://www.ibm.com/docs/en/aix/7.1?topic=p-ps-command
if i don't know the process to monitor? I know that some process were in the past but i don't know what they are
 
Suppose that a random process starts at time X and ends at time X + 5 seconds... Is there a way to discover the TID, PID, and name of process for instance at time X+6 seconds? I would like to get the same informations given by ps
I stand to be corrected, but I'm not sure that this is possible without having some scripting to catch processes and log them. Usually when a process is run, it's PID becomes visible in /proc, but once it's finished, it's PID disappears and becomes unavailable so far as I can make out. A script that runs as a daemon though could catch everything if that's what you're after.
 
Moving this to Command Line

Cheers

Wizard
 


Latest posts

Top