Top Command In Linux With Example
top command in linux

Top Command In Linux With Example

With the help of this command, you can get information about all the processes running on the Linux system. With the help of this command, all the running processes in the system can be viewed in the form of a summary. If you are a system admin, developer, or programmer, then you should know about this command because this command gives all the running processes of the system.

Top Command Report

When you execute this command in the Linux terminal, a summary table will open in the system screen, which will see all kinds of records related to the system’s process. If you do not have much knowledge about this command, then you may have a problem understanding the result of this command, so let’s understand all its options below.

Option Of Top command in Linux

OptionExplaiation
PIDEach process running on the system has a unique ID, so you can check the ID of that process as at present the unique ID of the Top command is 1938.
USERWith this option, you can find out who has run the command means who is the owner of the command
PRThis option in the top command indicates the priority of the command if the system ID of the process that uses the most resources will remain top.
NIThis option represents the nice value of the process if the nice value is negative then the process value will be higher and if the nice value is positive then the process value will be lower
VIRTShows how much virtual memory is used by this process
SHRHow many sizes of share memory have been used by this process as it can be seen on the screen that 3800 KB share memory has been used for the TOP command.
CPUHow much CPU is used for this command? The value of CPU usage can be seen in % format.
MemHow much system memory is used for this command. Memory usage values can be viewed in % format.
TimeWith this option, you can see the timing of the command, such as how many seconds ago the top command was executed.

When you execute this command in the terminal, it will run for an unlimited time until you forcefully terminate it. To forcefully terminate this command, press:q Or CTRL + C.

Collect Top Process Report in a File If you want to dump the report of all the processes running in the system in a file after a specific repetition, then for this you can execute the below command. For this, you have to first create empty file with any name then execute a top command by giving a specific repetition number.

Collect Top Process Report in a File by Top Command in linux

Display Specific User Process

If you want to Display All the process reports of commands run by a specific user, you have to run the command below.

top -u root
Display Specific User Process  by Top Command in linux

How to highlight running processes: If you want to see the running process of the top command in colorful, then after executing the top command, press the ‘z’ button.

How to highlight running processes in linux top Command

Short Running Process By PID Uses the ‘M’ and ‘T’ keys to display all the running processes in the system based on the PID.

Short Running Process By PID in Linux top Command

Kill running process By PID: If you want to kill a process without leaving the top Windows, then press the ‘K’ button from the keyboard, write PID Of that command, and press Enter.

Kill running process By PID in linux Top Command

Show the Process By CPU Utilisation If you want to see the CPU utilization report of the system with the help of the top command, then press ‘shift + P’ .

Show the Process By CPU Utilisation  in linux Top Command

Display absolute path of the process If you want to know the absolute path of the process running after executing the top command press the ‘c’ button.

Display absolute path of the process in Linux Top Command

Check System CPU Core and Core Utilisation If you want to find out how many cores are there in the CPU which is installed in the system and how much load is on each core of the process running in the system, you can press ‘1’ after executing the top command. This command is used in system trouble showing.

Check System CPU Core in linux top Command

Show All System Idle process If you want to display the list of all idle/sleeping processes in the system, then press the ‘i’ button.

Show All System Idle process  in linux Top Commadn

Need Top Command-related Help If you do not know all the options related to top command and you need system help about Top Command, then press the ‘h’ key.

get Help in Linux Top Commad

Change priority of the process Uses the ‘r’ option to change the process priority of the commands running in the system. It is also called Renice priority.

change  priority of the process in linux Top Command

Change Refresh Interval Time By Defaults the refresh interval time of the Top command is 3.0 seconds but if you want to change this time as per your requirement then press ‘d’ after executing the top command and set your desired Refresh Interval time.

As you can see in the below screen I have changed the top Refresh interval time from 3.0 seconds to 10 seconds.

Change Refresh Interval Time in Linux Top Command

Also, Visit our Other Website Simiservice.com

Rate this post
simi kaithal