top command is used to show the Linux processes. It provides a dynamic real-time view of the running system. Usually, this command shows the summary information of the system and the list of processes or threads which are currently managed by the Linux Kernel.
As soon as you will run this command it will open an interactive command mode where the top half portion will contain the statistics of processes and resource usage. And Lower half contains a list of the currently running processes. Pressing q will simply exit the command mode.
- PID: Shows task’s unique process id.
- PR: Stands for priority of the task.
- SHR: Represents the amount of shared memory used by a task.
- VIRT: Total virtual memory used by the task.
- USER: User name of owner of task.
- %CPU: Represents the CPU usage.
- TIME+: CPU Time, the same as ‘TIME’, but reflecting more granularity through hundredths of a second.
- SHR: Represents the Shared Memory size (kb) used by a task.
- NI: Represents a Nice Value of task. A Negative nice value implies higher priority, and positive Nice value means lower priority.
- %MEM: Shows the Memory usage of task.
1) Exit Top Command After Specific repetition: Top output keep refreshing until you press ‘q‘. With below command top command will automatically exit after 20 number of repetition.
top -n 10
2) Display Specific User Process
top -u paras
3) Highlight Running Process in Top: Press ‘z‘ option in running top command will display running process in color which may help you to identified running process easily
4) Shows Absolute Path of Processes: Press ‘c‘ option in running top command, it will display absolute path of running pro
5) Kill running process: You can kill a process after finding PID of process by pressing ‘k‘ option in running top command without exiting from top window as shown below.
6) Sort by CPU Utilisation: Press (Shift+P) to sort processes as per CPU utilization.
7) Shows top command syntax:
8) Batch Mode : Send output from top to file or any other programs.
9) Secure Mode : Use top in Secure mode.
10) Command Line : The below command starts top with last closed state.
11) Delay time : It tells delay time between screen updates.
Top -d seconds.tenths
- cvs command in Linux with Examples
- du command in Linux with examples
- df command in Linux with Examples
- seq command in Linux with Examples
- which command in Linux with examples
- sum command in Linux with Examples
- dc command in Linux with examples
- ZIP command in Linux with examples
- Cat command in Linux with examples
- arp command in Linux with examples
- tac command in Linux with Examples
- pwd command in Linux with Examples
- gs command in Linux with Examples
- more command in Linux with Examples
- atd command in Linux with examples
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.