Commands to view the run time of a process under Linux

Source: Internet
Author: User

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 brother even Linux training to share to everyone good method.

··· 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   pid OPENVPN  OPENVPN  pid pid , execute command, run time, User   , and user group   Span style= "FONT-FAMILY:CALIBRI;" >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 Check the process run time under Linux method of command, have you learned? ~


Commands to view the run time of a process under Linux

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.