Top
Introduction
The top command defaults to sorting processes by CPU usage rate and dynamically displaying the results.
Header Information
System Information
- Current system time: 09:19:05
- System running time: 6 days 10 hours 2 minutes
- Current logged in users: 2
- System average load: 1 minute, 5 minutes, 15 minutes
Process Summary
- Total number of processes: 126
- Number of running processes: 1
- Number of sleeping processes: 125
- Number of stopped processes: 0
- Number of zombie processes: 0
CPU Usage
- CPU usage of user processes: 0.5, user
- CPU usage of system processes: 0.0, system
- CPU usage of processes with
nice value
: 0.0 - Idle CPU usage: 99.5, idle
- CPU usage of processes waiting for IO: 0.0, wait
- CPU usage of handling hardware interrupts: 0.0, hardware interrupts
- CPU usage of handling software interrupts: 0.0, software interrupts
- CPU usage of CPU stolen by virtualization programs: 0.0, stolen
Memory Usage
- Unit: MiB, Million Byte
- Total: 1673.0 MB
- Free: 252.3 MB
- Used: 299.5 MB
- Cache: 1121.3 MB
Swap Usage
- Total: 0.0
- Free: 0.0
- Used: 0.0
- Available: 1197.7 MB (buff/cache)
A total of 0 may be due to the lack of swap space. You can use the following command to check.
If there is no output, it means that no swap space is configured.
Field Management Mode
Press f
or Shift + f
to enter the field management mode.
window 1:Def
The window number is 1, and the default (Default) field configuration is used.
Fields Display Order
Select the field that needs to be moved by pressing the right arrow key, move up and down, and then press Enter or the left arrow key to commit.
Fields Display Switch
After selecting the field, press d
or the space key.
Current Sorting Field
After selecting the field, press the s
key, which only takes effect in the current session.
Other Fields
go rocks
Multi-Window Mode
Press Shift + A
, and 4 top
windows will appear. The name of the window will be displayed in the upper left corner. Each window displays different fields and sorts in different ways, and can be modified through the field management mode.
Common Operations
- Return to single window mode:
Shift + A
- Select the next window:
a
key. - Select the previous window:
w
key. - Select a specific window:
g
key, select1-4
. - Modify the window name:
Shift + G
, enter 1-3 characters. - Enter the field management mode:
Shift + F
.
Common Windows
- 1:Def:Number 1, sorted in reverse order by
%CPU
. - 2:Job:Number 2, sorted in reverse order by
PID
. - 3:Mem:Number 3, sorted in reverse order by
%Mem
. - 4:Usr:Number 4, sorted in reverse order by
USER
.
Personalized Window Color
Press Shift + Z
to enter the color configuration mode. The following is written clearly.
- You can modify the configuration of different windows (1:Def) by pressing
a
orw
to select. - Available switches:
Shift + B
,z
,b
. - You can modify the colors of 4 parts,
Shift + S/M/H/T
. - The modified color can be entered as a number or selected using the up and down keys.
- Press
q
orEsc
to cancel the configuration, andEnter
to submit the configuration.
After exiting the color mode, if you want to persist the configuration, you need to press Shift + W
, and the file save path is:
Note that if you save in multi-window mode, it will also be in multi-window mode when you open it next time.
Common Shortcuts
Some shortcuts will also modify the properties of the current top command session window.
h
:Display the help menu, listing all available commands.0
:Toggle display/hide of fields with a value of 0.1
:Toggle display of CPU core usage.k
:Terminate a process, enter the PID.r
:Adjust the priority of the process (renice).z
:Toggle color display mode.x
:Highlight the column currently sorted.c
:Toggle display/hide of the command line.n
:Change the number of processes displayed, enter the number of processes to display.Shift + W
:Save the current configuration.Shift + Z
:Enter the color mode.Shift + P
:Sort by CPU usage rate.Shift + M
:Sort by memory usage rate.Shift + N
:Sort by PID.Shift + T
:Sort by process running time.
Special Fields
PR
Priority.
NI
Nice Value.
VIRT
Virtual Image (KiB).
RES
Resident Size (KiB).
SHR
Shared memory size.
S
Process status, refer to PS command.
TIME+
CPU Time, hundredths, the total CPU time occupied by the process after startup.