How long has it been running for a novice on a Linux system to see a process on my Ubuntu Server (or, depending on the process ID )? The following brothers share Linux with a good way to everyone.
··· You need to use the PS command to view information about a set of running processes. the PS Command provides the following two formatting options.
ETime shows the time that has passed since the process started, formatted as [[Dd-]hh:]mm:ss.
Etimes shows the time, in seconds, that has passed since the process started.
How do I see how long a process has been running?
You need to add the- o etimes or - o etime parameter after the PS command . Its syntax is as follows:
ps-p {pid-here}-o etime
ps-p {pid-here}-o Etimes
Step one: Find the PID of a process (OpenVPN for example )
$ pidof OpenVPN
6176
Step two: How long does the OpenVPN process run?
$ ps-p 6176-o etime
Or
$ ps-p 6176-o Etimes
Hide Output Header:
$ ps-p 6176-o etime=
$ ps-p 6176-o etimes=
This 6176 is the PID of the process you want to view . In this example, I'm looking at the OpenVPN process. You can change the OpenVPN process name or PIDAccording to your needs. In the example below is the PID, Execution command, run time, user ID, and user group ID:
$ ps-p 6176-o Pid,cmd,etime,uid,gid
Sample output:
PID CMD ELAPSED UID GID
6176/usr/sbin/openvpn--daemon 15:25 65534 65534
This is how the command to view the run time of the process under Linux , you learned it ~
Commands to view the run time of a process under Linux