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]

 


  • Top 18 Best Web Hosting Services In 2024: Despite there are multiple web hosting providers available in the market, choosing the best one is really a hard nut to crack!! Because almost all service providers are offering their services with the same features and quality.
  • How to start your own Crypto currency website: For a cryptocurrency news website, choosing the right Content Management System (CMS) is crucial for managing content effectively, ensuring security, and providing a great user experience. Here are some of the best CMS options tailored for such a site, each with its unique strengths:
  • The Evolution of Coffee Brewing Methods: A Historical Perspective: Coffee has been brewed and enjoyed for centuries, with various methods evolving over time to create the perfect cup of joe. From early methods like the Ibrik method and coffee pots for coffee houses to modern technologies like the AeroPress and Hario V60, the world of coffee brewing has come a long way.
  • Stop WordPress from Creating Extra Cropped Image Sizes: Whenever you upload an image to your WordPress site through the media library, it automatically creates and stores multiple additional versions of that image. If your site doesn’t utilize these extra image sizes, they will consume valuable storage space and increase the size of your server backups.
  • Explain WordPress Portfolio and how to created them: WordPress portfolios are digital showcases for individuals or businesses to display their work, projects, or professional accomplishments. This feature is particularly useful for creatives, freelancers, and agencies looking to exhibit their skills or services in a visually appealing and organized manner. Portfolios in WordPress can be created using various methods, including themes that come with built-in portfolio functionalities, plugins that add portfolio features, or custom coding for a more personalized approach.
  • 15 Essential WordPress Plugins For Every Site: Plugins are essential for every type of website, as they provide additional features and customization options that are not available in the core WordPress platform. A study by CodeinWP found that the average WordPress site has 20 active plugins, indicating the importance of plugins in website development.
  • SAILING and YACHTING: Awesome Sailing Vlogs for the Enthusiast
  • Comparing Google and Microsoft’s Success in Capitalizing on Generative AI: The buzz of interest in AI services helped drive revenue for Microsoft’s biggest unit, cloud services—up by 7 percentage points compared to a year ago—and Microsoft’s overall sales rose 17 percent to nearly $62 billion. It also gained cloud market share, Nadella added. The number of $100 million cloud deals that Microsoft landed increased 80 percent during the quarter compared to the same period a year ago, and $10 million deals doubled.
  • The Best WordPress Hosting Solution in Australia: Each of our WordPress hosting solutions are fine-tuned, blazing fast and are ready for you! Starting a WordPress website has never been easier with our free 1-click WordPress installation, enterprise-grade security and an assortment of tutorials and helpful guides to get you started, all backed by our 99.9% uptime guarantee.
  • Elementor vs Beaver Builder: A Comparison of Design Flexibility and Performance in WordPress: Elementor and Beaver Builder are two of the most widely recognized options, each providing distinct features that cater to varying user requirements. This article conducts a comprehensive comparison of these tools, examining their design flexibility, performance metrics, and overall user experience.
  • The Best Contact Form Plugins for WordPress to Easily Manage User Inquiries: In an effort to improve user interactions on WordPress websites hosting, the examination of contact form plugins becomes essential. This article aims to present an overview of the top 5 contact form plugins available for WordPress, highlighting their features and pricing structures to facilitate an well-considered choices process.
  • What are the 20 best Joomla plugins: Joomla plugins are small, task-specific extensions that enhance or modify the core functionality of a Joomla website. They operate as event-driven scripts, listening for specific “events” triggered by Joomla or its components and executing corresponding actions. Plugins are a crucial part of Joomla’s extensibility, allowing developers to add features or customise behaviour without altering the core Joomla code.
  • How to design a strong off-page SEO strategy: Lessons learnt from earning over 50,000 contextual links for thousands of websites in the toughest niches. In 2023, virtually every business that has a website is prioritizing their investment in SEO. The reason being, amidst the chaos of the current year, customers are resorting to online channels for safe purchasing, and optimizing their online presence is a surefire way to gain an edge over rivals. While some firms have set up internal teams, and others have hired external agencies to boost their search engine rankings, a documented off-page SEO strategy is still a rarity among most businesses.
  • What are WordPress Plugins? WordPress plugins are modular pieces of software that can be added to a WordPress site to extend or enhance its functionality without modifying the core WordPress code. They allow website owners to add features, improve performance, and customise the behaviour of their websites easily, catering to a wide range of needs, from SEO and security to e-commerce and design enhancements.

 

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.

Similar Posts