Linux View process startup time (how long does it run)Reproduced
Tags: ps -eo lstart etime |
|
Ps-eo Lstart Start time
How long does the Ps-eo etime run?
Ps-eo Pid,lstart,etime | grep 5176 use Linux PS query process start time PS Command common usage (easy to view system process) 1 PS A shows all programs under current terminals, including other user programs. 2) ps-a shows all processes. 3 PS C, when listing the program, displays the actual instruction name of each program, not the path, parameter, or indication of the resident service. 4) Ps-e The effect of this parameter is the same as the specified "A" parameter. 5 PS e Displays the environment variables used by each program when the program is listed. 6 PS F Displays the tree structure in ASCII characters, expressing the interrelationship between programs. 7) ps-h displays a tree structure that represents the interrelationships between programs. 8 PS-N Displays all programs except those under the PS instruction terminal. 9 PS s uses program signal format to display program status. www.2cto.com PS S lists programs, including interrupted subroutine data. ps-t< Terminal number > Designated terminal number, and list the status of the program belonging to the terminal. PS u displays program status in user-oriented format. PS x shows all programs and is not differentiated by terminals. The most common method of is to Ps-aux, and then use a pipe symbol to guide grep to find a particular process and then operate on a particular process. Common parameters: -A shows all processes (equivalent to-e) (utility) -a shows all processes for a terminal, except session leader -N ignores selection. D displays all processes, but omits all session leader (utility) x shows processes that do not control the terminal, and displays the specific path of each command. DX is not suitable. (utility) -p PID process uses CPU time -u uid or username to select a valid user ID or a user name -G gid or groupname all processes that display the group. U username Displays all the processes under the user and displays the detailed path to each command. such as: PS U Zhang; (utility) -F is all listed, and is typically associated with other options. such as: Ps-fa or PS-FX and so on. -l long Format (with f,wchan,c fields) -J job format www.2cto.com -o user-defined format. v display in virtual memory format s in signal format -m shows all threads -H displays the level of the process (and other commands, such as: ps-ha) (utility) after the e command displays the environment (e.g. ps-d E Ps-a e) (utility) H does not display the first line Ps-eo Lstart start time Ps-eo etime How long to run . PS -eo pid,lstart,etime|grep pid case: Ps-eo pid,lstart,etime|grep 4559
You need to use the PS command to view information about a set of running processes. The PS command provides two formatting options, such as the following. ETime shows the time that has been experienced since the process started, in the format [[Dd-]hh:]mm:ss]. Etimes shows how long it has been since the process started, in seconds. How to view the time that a process has been running.
You need to add the-o etimes or the-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 a process PID (OpenVPN for example)
$ pidof OpenVPN 6176
Step Two: OpenVPN How long the process has been running.
$ ps-p 6176-o etime
Or
$ ps-p 6176-o Etimes
Hide Output Header:
$ ps-p 6176-o etime= $ ps-p 6176-o etimes=
Sample output:
This 6176 is the PID of the process you want to view. In this case, I'm looking at the OpenVPN process. You can change the OpenVPN process name or PID according to your needs randomly. In the example below, I printed the PID, execute 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