top - 15:35:31 up 2:00, 1 user, load average: 0.90, 1.29, 1.42
Tasks: 410 total, 1 running, 408 sleeping, 0 stopped, 1 zombie
%Cpu(s): 2.2 us, 3.1 sy, 0.0 ni, 94.7 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
MiB Mem : 31957.2 total, 1377.1 free, 14744.4 used, 15835.6 buff/cache
MiB Swap: 2048.0 total, 2048.0 free, 0.0 used. 15602.7 avail Mem
第二行,Task: 410 个进程总数,1个进正在运行,408个在休眠,0和已经停止,1个僵尸进程
第三行,CPU
Line 2 shows CPU state percentages based on the interval since the last refresh.
As a default, percentages for these individual categories are displayed. Where two labels are shown below, those for more recent ker‐
nel versions are shown first.
us, user : time running un-niced user processes
sy, system : time running kernel processes
ni, nice : time running niced user processes //用于运行修改过nice值的用户进程占用的cpu时间
id, idle : time spent in the kernel idle handler //idle 空闲。
wa, IO-wait : time waiting for I/O completion
hi : time spent servicing hardware interrupts
si : time spent servicing software interrupts
st : time stolen from this vm by the hypervisor
第四、五行为内存和交换分区,前面KiB或者MiB是单位。
# 一 按内存、CPU排行
Shift + M 或者 P
# 二、查看进程的线程
H 控制显示线程与否
1. 查看所有
top
2. 指定pid
top -p {pid}
3. 查看指定进程的线程
top -T -p {pid}
//也可以用 ps -T -p {pid}
//列出其所有线程