Catalog / top Command Cheatsheet
top Command Cheatsheet
A comprehensive guide to the `top` command, covering process monitoring, system resource usage, and interactive commands for Unix-like operating systems.
Basic Usage
Starting top
To start the
|
The display updates periodically, showing a snapshot of the system’s processes. |
Understanding the Display
The
|
Summary Area Fields
uptime |
Shows how long the system has been running, the number of logged-in users, and the system load average. |
Tasks |
Displays the total number of tasks, along with their statuses (running, sleeping, stopped, zombie). |
%Cpu(s) |
Shows CPU usage statistics (user, system, idle, etc.). |
KiB Mem |
Displays memory usage (total, free, used, buffer/cache). |
KiB Swap |
Shows swap space usage. |
Interactive Commands
Basic Commands
|
Displays the help menu. |
|
Quits the |
|
Shows CPU usage per core (if supported). |
Sorting Processes
|
Sorts processes by CPU usage (descending). |
|
Sorts processes by memory usage (descending). |
|
Sorts processes by PID (Process ID). |
|
Reverses the sorting order. |
|
Sorts processes by runtime. |
Filtering Processes
|
Filters processes by username. Prompts for a username. |
|
Adds a filter based on other fields. Prompts for a filter condition. |
|
Clears all active filters. |
Process Management
Killing Processes
|
Kills a process. Prompts for the PID of the process to kill and the signal to send (default is 15, SIGTERM). |
Example |
To kill a process with PID 1234 using the default SIGTERM signal:
|
Changing Priority (Renice)
|
Renices a process. Prompts for the PID of the process and the new nice value. |
Note |
Only root can increase the priority (lower the nice value) of a process. |
Example |
To renice a process with PID 5678 to a nice value of 10:
|
Advanced Features
Customizing Display Fields
|
Adds or removes fields from the task display. Allows you to customize which columns are shown. |
|
Changes the delay time between screen updates in seconds. |
Alternate Displays
|
Toggles forest view, showing parent-child relationships between processes. |
|
Toggles the display of the full command path instead of just the command name. |
|
Search for the string. |
Command Line Options
Example:
|
Example:
|
Example:
|
|