15 C
Texas
Muhammad Nabeel
Network and System Administrator

How to Use top Command in Linux

top (table of process) command allows users to monitor processes, CPU information and memory utilization in Linux. It is pre-installed on all linux distributions. In this article we will learn that how to use top command.

Run top command and it will show the following

top

- Advertisement -

PID:    Shows each task unique process id.
PR:      Shows task priority
SHR:    Represents the amount of shared memory used by a task.
VIRT:   Total virtual memory.
USER:  User name or owner of task.
%CPU: Represents the CPU usage.
TIME+: CPU Time
SHR:    Display Shared Memory in kb used by a task.
NI:      Shows a Nice Value of task. A Negative nice value means higher priority, and positive Nice value means lower priority.
%MEM: Shows the Memory usage of task.

press “q” on your keyboard to quite from top.

Highlight Running Process in Top

When you execute top command press “z” key to highlight running processes.

Show Path of Processes

press “c” after running top command and it will show the path of processes as you can see in image below.

Kill running process

when you run top command you can see all processes along with their process id (PID)

If you want to kill a process,
simply run “top” command to find your specific process ID,
press “k” and then type your PID number
and press “enter” key to kill it.

Renice a Process

renice is used to change a process priority,

simply run “top” command to find your specific process ID, e.g I will renice the priority of PID 27
Press ‘r‘ option to change the priority of the process.
Now enter you process ID (Example is in image below)

Then you will see “Renice PID to value” enter new priority value,

That’s it.

- Advertisement -
Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"

LEAVE A REPLY

Please enter your comment!
Please enter your name here



Latest article