How to Monitor System Activity in Linux Using the `top` Command

Discover the power of the top command in Linux for real-time monitoring of system activity, managing processes, and optimizing resource usage.

Posted Mon, May 20, 2024


How to Monitor System Activity in Linux Using the `top` Command

The `top` command is a powerful utility in Linux used to provide a real-time, dynamic view of a system's performance. It offers a comprehensive summary of system resources and a detailed list of running processes or threads managed by the Linux Kernel. Here's how you can effectively utilize the `top` command to monitor system activity.

To initiate the `top` command, simply open a terminal window and type:




This command will display a continuously updating screen presenting various system metrics. By default, processes are sorted by CPU usage in descending order, with the most resource-intensive processes listed at the top.

Understanding `top` Output:

The `top` command provides a wealth of information, including:

PID: Process ID, uniquely identifying each task.

PR: Process priority, with lower numbers indicating higher priority.

VIRT: Total virtual memory utilized by the task.

USER: Username of the task owner.

%CPU: CPU usage percentage by the task.

TIME+: CPU time, displaying hundredths of a second for granularity.

SHR: Shared memory size used by the task.

NI: Nice value of the task, affecting its priority.

%MEM: Memory usage percentage of the task.

RES: Physical RAM consumed by the process, measured in kilobytes.

COMMAND: Command name initiating the process.

Examples of `top` Command Usage:

Exit after Specific Repetition: Use `-n` option to exit `top` command automatically after a defined number of repetitions:


top -n 10


2. Display Specific User Process: Filter `top` output to show processes of a specific user using the `-u` option:


top -u username


3. Highlight Running Processes: Press `z` within the `top` command to display running processes in color, aiding in easy identification.

4. Show Absolute Path of Processes: Press `c` within the `top` command to display the absolute path of running processes.

5. Kill Running Process: Terminate a process directly from `top` command by pressing `k` and entering the PID of the process to be killed.

6. Sort by CPU Utilization: Sort processes by CPU usage by pressing `Shift+P`.

7. View Command Syntax: Learn about different options and syntax using `-h` option:


top -h


8. Batch Mode: Utilize `-b` option to send `top` output to a file or other programs.


top -b


9. Secure Mode: Run `top` in secure mode using `-s` option.


top -s


10. Command Line History: Initiate `top` with the last closed state using `-c` option.


top -c


11. Set Delay Time: Adjust the delay time between screen updates using `-d` option.


top -d seconds.tenths



The `top` command is indispensable for Linux users and system administrators, providing real-time insights into system processes and resource utilization. Its dynamic interface, interactive commands, and customizable options make it an invaluable tool for monitoring and troubleshooting system performance effectively. Whether sorting processes, terminating tasks, or filtering by user, `top` offers a concise yet comprehensive view of system health, enabling users to maintain optimal performance effortlessly.


Similar Topics
How to Set Timeout for a JavaScript Promises

Master setting timeouts on JavaScript promises with reliability using Promise.race and async/await paired with setTimeout.

Cybersecurity for Developers

Offering insights into cybersecurity essentials for developers, covering topics like secure coding, encryption, and common security vulnerabilities

The True Cost of Technology: Why Tech Professionals Command High Salaries

Unlocking the Value: Exploring the Factors Behind High Salaries for Tech Professionals- Precision, Innovation, Adaptability.

Subscribe to Our Blog

Be the first to know whenever we publish a new article. We're confident that each piece we share will be well worth your time and provide valuable insights

More for you

Which is better, Next.js or Laravel?

Choosing between Next.js and Laravel? Consider proficiency, project scale, and strengths. Here are points to guide your decision.

Emmanuel Adesina

21st September, 2023

Which Programming Language Should You Learn First?

Starting Your Career in Programming: A Guide to Choosing the Perfect Programming Language to Start with as a Beginners.

Emmanuel Adesina

7th October, 2023

The Power of React Native: Building Cross-Platform Mobile Apps

Exploring the Advantages of React Native for Mobile App Development

Emmanuel Adesina

17th October, 2023

Teners is trusted on TechBehemoths

Contact Us

Let's discuss your idea... Lets Build, Launch and Grow together.

Contact Us

© 2023 All rights researved

Legal • Privacy Policy