Linux top command

Kenight_ 2022-06-24 08:03:47 阅读数:762


top The command can dynamically view the overall operation of the system in real time

Command options

-b: Operate in batch mode
-c: Show full command
-d: Screen refresh interval
-I: Ignore failure process
-s: Confidentiality mode
-S: Cumulative mode
-i< Time >: Set interval
-u< user name >: Specify user name
-p< Process number >: Specify process
-n< frequency >: Number of cycles

Interactive commands

Get into top After interactive view , You can execute the following commands

h: Display help screen , Give a brief summary of the command
k: terminate a process
i: Ignore idle and dead processes , This is a switch command
q: Exit procedure
r: Re prioritize a process
S: Switch to cumulative mode
s: Change the delay time between refreshes ( Unit is s), If there are decimals , Just translate it into ms. Input 0 Value, the system will continue to refresh , The default value is 5s
f: Add or remove items from the current display
o: Change the order in which items are displayed
l: Switch to display the average load and start-up time information
m: Toggle display memory information
t: Toggle display progress and CPU State information
c: Toggle display command name and full command line
M: Sort by resident memory size
P: according to CPU Sort by percentage size
T: According to time / Sort the cumulative time
w: Write current settings to ~/.toprc In file

Analysis of interactive view

first line essential information

Current system time /  The system has been running for /  Online users /  System load load average: 0.04, 0.06, 0.09 : The three values are 1 minute 、5 minute 、15 The average from minutes ago to now

The second line  Tasks Process information

174 total The total number of processes

1 running Number of running processes

173 sleeping The number of processes in sleep

0 stopped Number of processes stopped

0 zombie Number of zombie processes

The third line Cpu Information

0.2 us  User process occupation cpu Percentage

0.0 sy  The system occupies cpu Percentage


In the fourth row KiB Mem  Memory information

4028720 total Total memory 4G

2769516 free Amount of free memory

682828 used Memory usage

576376 buff/cache Amount of memory cached

The fifth row Swap Information


Sixth elements List of details

PID  Process number

USER  Process Creator

PR  Process priority

NI nice value , The smaller, the higher the priority , Minimum -20, Maximum 20( The user sets the maximum 19)

VIRT  Total virtual memory used by the process , Company kb,VIRT=SWAP+RES

RES  Used by process , Physical memory size not swapped out , Company kb,RES=CODE+DATA

SHR  Shared memory size , Company kb

S  Process status ,D= Uninterrupted sleep R= function S= sleep T= track / stop it Z= Zombie process

%CPU  Process occupation cpu percentage

%MEM  Percentage of memory used by the process

TIME+  Process run time

COMMAND  Process name

copyright:author[Kenight_],Please bring the original link to reprint, thank you.