How to Check How Long a Process Has Been Running in Linux

Take Your Linux Skills to the Next Level All courses, certifications, ad-free articles & community — from $8/mo
Join Root →
Ad-free access to all premium articles
Access to all courses: Learn Linux, AI for Linux, Bash Scripting, Ubuntu Handbook, Golang and more.
Access to Linux certifications (RHCSA, RHCE, LFCS and LFCA)
Access new courses on release
Get access to weekly newsletter
Priority help in comments
Private Telegram community
Connect with the Linux community
From $8/mo · or $59/yr billed annually · Cancel anytime

Linux, with its powerful command-line interface, provides users with a myriad of tools to monitor and manage processes efficiently.

One essential piece of information for troubleshooting or system optimization is knowing how long a process has been running.

In this article, we’ll explore simple commands that new Linux users can use to check the duration of a running process.

1. ps Command

The ps command is a fundamental tool for viewing information about processes on a Linux system.

To find out how long a process (program or application) has been running, open a terminal and type the following command:

ps -eo pid,comm,etime
List Process Running Time in Linux
List Process Running Time in Linux

This command lists the process ID (PID), command name, and elapsed time (etime) for all processes. The elapsed time column displays the time duration in the format “dd-hh:mm:ss“, where “dd” represents days, “hh” represents hours, “mm” represents minutes, and “ss” represents seconds.

For a more targeted approach, you can combine the `ps` command with the grep command to filter out information about a specific process.

ps -eo pid,comm,etime | grep "process_name"

This command narrows down the output to only display information about the specified process, making it easier to determine how long it has been running.

Get Process Running Time in Linux
Get Process Running Time in Linux

2. top Command

For a more user-friendly and interactive process monitoring experience, you can use the top command, which is used to provide a real-time overview of all running processes along with various details like CPU usage, memory usage, and running time.

top

After running the top command, just press 'c' to toggle between different display options and locate the desired process, and its uptime will be displayed in the "TIME+" column, which represents the total accumulated CPU time for each process.

Check Process Running Time in Linux
Check Process Running Time in Linux

3. System Monitor GUI Tool

Linux also offers graphical user interfaces (GUIs) for those who prefer a visual representation of system information. The GNOME System Monitor is a popular choice for many Linux distributions.

To install the GNOME System Monitor on a Linux system, you can use the package manager specific to your Linux distribution.

sudo apt install gnome-system-monitor         [On Debian, Ubuntu and Mint]
sudo yum install gnome-system-monitor         [On RHEL/CentOS/Fedora and Rocky/AlmaLinux]
sudo emerge -a sys-apps/gnome-system-monitor  [On Gentoo Linux]
sudo apk add gnome-system-monitor             [On Alpine Linux]
sudo pacman -S gnome-system-monitor           [On Arch Linux]
sudo zypper install gnome-system-monitor      [On OpenSUSE]    
sudo pkg install gnome-system-monitor         [On FreeBSD]

Once installed, you can launch it from the application menu or by running:

gnome-system-monitor

Navigate to the “Processes” tab, find your desired process, and check the “CPU Time” column, which will display the total CPU time consumed by a process, offering a quick glance at its running duration.

Find Process Running Time in Linux
Find Process Running Time in Linux
Conclusion

Understanding how long a Linux process has been running is a crucial skill for both troubleshooting and optimizing system performance. With these simple commands, new Linux users can easily retrieve information about process duration, gaining valuable insights into their system’s activity.

Whether using basic commands like ‘ps‘ or ‘top‘ and GUI options like GNOME System Monitor, Linux provides a variety of tools to meet the diverse needs of its users.

As you continue your Linux journey, mastering these commands will empower you to efficiently manage and monitor processes on your system.

Root Plan
Premium Linux Education for Serious Learners

Take Your Linux Skills to the Next Level

Root members get full access to every course, certification prep track, and a growing library of hands-on Linux content — with new courses added every month.

What You Get
Ad-free access to all premium articles
Access to all courses: Learn Linux, AI for Linux, Bash Scripting, Ubuntu Handbook, Golang and more.
Access to Linux certifications (RHCSA, RHCE, LFCS and LFCA)
Access new courses on release
Get access to weekly newsletter
Priority help in comments
Private Telegram community
Connect with the Linux community
Ravi Saive
I'm Ravi Saive, an award-winning entrepreneur and founder of several successful 5-figure online businesses, including TecMint.com, GeeksMint.com, UbuntuMint.com, and the premium learning hub Pro.Tecmint.com.

Each tutorial at TecMint is created by a team of experienced Linux system administrators so that it meets our high-quality standards.

Join the TecMint Weekly Newsletter (More Than 156,129 Linux Enthusiasts Have Subscribed)
Was this article helpful? Please add a comment or buy me a coffee to show your appreciation.

Got Something to Say? Join the Discussion...

Thank you for taking the time to share your thoughts with us. We appreciate your decision to leave a comment and value your contribution to the discussion. It's important to note that we moderate all comments in accordance with our comment policy to ensure a respectful and constructive conversation.

Rest assured that your email address will remain private and will not be published or shared with anyone. We prioritize the privacy and security of our users.

Root Plan Premium Linux Education for Serious Learners

Before You Go - Upgrade Your Linux Skills

Root members get everything in one place, with new courses added every month.

What You Get
Ad-free access to all premium articles
Access to all courses: Learn Linux, AI for Linux, Bash Scripting, Ubuntu Handbook, Golang and more.
Linux certifications: RHCSA, RHCE, LFCS and LFCA
Access new courses on release
Weekly newsletter, priority support & Telegram community
Join Root Today and Start Learning Linux the Right Way
Structured courses, certification prep, and a community of Linux professionals - all in one membership.
Join Root Plan →
$8/mo · or $59/yr billed annually