WebHosting

Thursday, September 14, 2023

How to check runing time for already #running #process in #linux #shor...


To determine how long a process has been running in Linux using its Process ID (PID), you can use the ps command in combination with the -o (output format) option to display the elapsed time. Here's how you can do it:
Open your terminal and enter the following command, replacing [PID] with the actual PID of the process you want to check:

bash
ps -p [PID] -o etime=


-p [PID]: Specifies the PID of the process you want to examine.
-o etime=: Specifies the output format for the elapsed time of the process.

This command will display the elapsed time in the format DD-HH:MM:SS, indicating the number of days, hours, minutes, and seconds the process has been running.

For example, if you want to check the running time of a process with PID 12345:

bash
ps -p 12345 -o etime=

The output will look something like this:

01-23:45:12

In this example, the process has been running for 1 day, 23 hours, 45 minutes, and 12 seconds.

No comments:

Post a Comment

Thank you for Commenting Will reply soon ......

Featured Posts

How to Enable and Configure Remote Desktop (RDP) on Ubuntu 24.04.4 LTS

Remote Desktop Protocol (RDP) support in Ubuntu has become considerably easier with the GNOME Remote Desktop stack included in modern Ubuntu...