How To Check The Running Time Of A Process In Linux/Unix ?
This post was last updated on August 1st, 2020 at 10:13 am
In Unix like operating systems, a process is a program in execution. The running time of a process means how long a process has been running on a system. There are different ways to determine the running time of processes in the Linux or Unix system for example by using an etime option with ps command. So let us find the running time of a process.
There can be multiple processes running in a system. Kernel identifies each process with a unique id called process id or PID. To find the PID of a process first open your terminal and then execute the following command –
For example to find the PID of Rhythmbox use –
Now you can see the PID of Rhythmbox which is 2423. We need to find the PID of a process in order to find the running time using the ps command as given in the coming section.
Display the running time using ps command
The ps (process status) command displays information about a selection of active/running processes. We will use the following two options to display running time –
etime – It displays elapsed time since the process was started, in [[DD-]hh:]mm:ss format.
etimes– It displays elapsed time since the process was started in seconds
Find running time using etime option
To display the running time use the following command in your terminal –
ps -p PID -o etime
For example to display the running time of the process with PID 2423, use –
ps -p 2423 -o etime
Find running time using etimes option
To display the running time use the following command in your terminal, this will display the running time in seconds –
ps -p PID -o etimes
For example to display the running time of process with PID 2423, use –
ps -p 2423 -o etimes
In this article, you learned to find the PID and then use it to determine how long a process has been running in a system. If you want to know more about ps command then see its manual page by using
Now if you want to know more about the usage of ps command you can read how to check the status of active processes using ps command.
You might also like
This post was last updated on August 1st, 2020 at 12:30 pmUbuntu comes in two releases the first one is LTS and the second is standard versions. LTS (Long Term
This post was last updated on August 1st, 2020 at 02:53 pmA system backup is a process in which the state, files, and data of a computer system are copied
This post was last updated on August 3rd, 2020 at 03:13 pmContents1 Introduction to vi2 Starting vi in your terminal3 Vi Operating modes4 Moving cursor around text5 Entering, modifying and