Skip to main content

Introduction to the `top` Command in Linux

In Linux, the top command is an interactive utility that provides a real-time, dynamic view of the processes running on a system. It displays information about CPU, memory, and other resources, allowing users to monitor system performance and manage processes effectively. With top, users can identify resource-intensive tasks and make informed decisions on system resource management.

Utilizing the top Command

To use the top command, simply type top in your terminal and press Enter. You will be presented with a real-time updating list of the active processes and their resource usage.

$ top

Understanding the top Output

The top command display is divided into two sections. The top section provides a summary of the system's current state, including uptime, load average, and the number of tasks. The bottom section lists individual processes and their details.

Information Fields and Their Descriptions

Here is a table detailing the common information fields displayed by top and what each field represents:

PIDProcess ID, a unique number assigned to identify each process.
USERThe owner or the user who started the process.
PRPriority of the process.
NINice value, a user-space way to set priority of a process.
VIRTVirtual Memory Size of the process (includes all memory).
RESResident Memory Size, the actual amount of physical memory used.
SHRShared Memory Size, the amount of shared memory used by a task.
SProcess Status: R (running), S (sleeping), Z (zombie), etc.
%CPUThe percentage of CPU used by the process.
%MEMThe percentage of RAM (physical memory) used by the process.
TIME+Total CPU time used by the process since it started.
COMMANDThe command that started the process, including command-line options.

Practical Usage of top

While top is running, you can interact with it using various commands:

  • Pressing k allows you to kill a process by entering its PID.
  • Pressing u followed by a username shows only processes owned by that user.
  • Pressing r allows you to change the priority (nice value) of a process.
  • Pressing q quits top.

Command Keys For the top Command

While top is running, users can interact with it using a variety of shortcut keys to access different features or manipulate the display. Here’s a list of available shortcuts and their functions in the top command:

Shortcut KeyDescription
h or ?Displays help screen showing almost all the commands available.
qQuits top.
kKills a process. User is prompted to enter the PID of the process to be killed.
rRenices a process. User is prompted to enter the PID of the process to be reniced.
uDisplays only the processes owned by a specified user.
n or #Allows the user to configure the number of processes to be displayed.
MSorts the processes by memory usage.
PSorts the processes by CPU usage.
TSorts the processes by time/cumulative time.
cToggles command line/command name display.
mToggles between different memory information displays.
tToggles between different CPU information displays.
f or FEnters the field select mode, allowing you to add, remove, or re-order columns/fields.
eChanges the memory scaling factor, cycling between kibibytes (KiB), mebibytes (MiB), gibibytes (GiB), and tebibytes (TiB).
lToggles the display of load average and uptime information.
sChanges the delay between updates (screen refresh rate).
zToggles color/mono.
xHighlights the sorted column.
yToggles the display of the running tasks in the summary area.
bToggles bold enable/disable.
WWrites the current setup to the ~/.toprc file, making it the default for future sessions.
< or ,Moves the sorting column one to the left.
> or .Moves the sorting column one to the right.
d or DShows or sets the delay (in seconds) between updates.
VTrees view of processes, showcasing the parent-child relationships.
HToggles the display of threads.
LAllows user to locate a string within top.

Each of these shortcuts can help users to swiftly and efficiently navigate through the top command, manipulate its displays, or perform specific actions on processes, enabling more effective system monitoring and management.


The top command in Linux is a powerful and interactive tool to monitor processes and system resources. It provides a real-time view of the system’s performance, allowing users to identify resource-consuming processes and manage system load efficiently. Understanding the information provided by top and knowing how to interpret it is crucial for maintaining a healthy and responsive Linux system. By mastering top and its various features, users and administrators can optimize resource allocation, troubleshoot issues, and ensure smooth system operation.

What Can You Do Next 🙏😊

If you liked the article, consider subscribing to Cloudaffle, my YouTube Channel, where I keep posting in-depth tutorials and all edutainment stuff for software developers.

YouTube @cloudaffle