top

Display or manage running programs

Supplementary instructions

top command can dynamically view the overall operation of the system in real time. It is a practical tool that integrates multi-party information monitoring system performance and operation information. The interactive interface provided by the top command can be managed using hotkeys.

grammar

top(option)

Options

-b: operate in batch mode;
-c: Display the complete treatment command;
-d: screen refresh interval;
-I: Ignore the failure process;
-s: confidentiality mode;
-S: accumulation mode;
-i<time>: set the interval time;
-u<username>: Specify username;
-p<process number>: specifies the process;
-n<number of times>: the number of times displayed in a loop;
-H: Resource usage of all threads.

top interactive command

Some interactive commands that can be used during the execution of the top command. These commands are all single-letter, and some of them may be blocked if the -s option is used on the command line.

h: Display the help screen and give some brief command summary instructions;
k: terminate a process;
i: Ignore idle and zombie processes, this is a switch command;
q: Exit the program;
r: Rearrange the priority of a process;
S: switch to accumulation mode;
s: Change the delay time between two refreshes (unit is s). If there is a decimal, convert it to ms. Enter a value of 0 and the system will refresh continuously. The default value is 5s;
f or F: Add or delete items from the current display;
o or O: Change the order of displayed items;
l: Switch to display average load and startup time information;
m: Switch to display memory information;
t: Switch to display process and CPU status information;
c: Switch to display the command name and complete command line;
M: Sort according to resident memory size;
P: Sort according to CPU usage percentage;
T: Sort based on time/accumulated time;
w: Write the current settings to the ~/.toprc file.

Example

top - 09:44:56 up 16 days, 21:23, 1 user, load average: 9.59, 4.75, 1.92
Tasks: 145 total, 2 running, 143 sleeping, 0 stopped, 0 zombie
Cpu(s): 99.8%us, 0.1%sy, 0.0%ni, 0.2%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
Mem: 4147888k total, 2493092k used, 1654796k free, 158188k buffers
Swap: 5144568k total, 56k used, 5144512k free, 2013180k cached

explain: