【linux命令学习】之top
先上man:
name: top - display Linux tasks
synopsis: top -hv | -bcHisS -d delay -n iterations -p pid [, pid ...]
description:The top program provides a dynamic real-time view of a running system. It can display system summary information as well as a list of tasks
currently being managed by the Linux kernel. The types of system summaryinformation shownand the types, order and size of information dis-
played for tasks are all user configurableand that configuration can be made persistent across restarts.
显示的信息是可以配置的,而且重启后仍能生效。
The program provides a limited interactive interface for process manipulation as well as a much more extensive interface for personal configura-
tion -- encompassing every aspect of its operation. And while top is referred to throughout this document, you are free to name the program
anything you wish. That new name, possibly an alias, will then be reflected on top's display and used when reading and writing a configuration
file.
提供有限的交互。
top相关操作(参数说明):
使用'h'或者?来获取帮助,使用'q'退出top或者用ctrl^c进行”暴力退出“。
top界面:
分为4个部分:1、Summary2、Message/Prompt行3、列名4、Task
top启动参数语法:
top -hv | -bcHisS -d delay -n iterations -p pid [, pid ...]
-h:显示帮助
-v:显示版本后退出
-b:批处理模式。将top的输出结果发送到其他程序或者文件中。在这个模式下,top将不接受任何输出。
-c:命令行/程序名切换。启动top时将切换上次记住的c的状态。如上次为命令行,则本次启动为程序名。
-H:线程。和c一样,也是个状态切换指令,带有此参数将会切换上次记录的H状态。
-i:闲置进程。是否显示闲置进程,也是个切换命令。
-s:安全模式。启动时将强制开启此模式。
-S:累积时间模式。
-d:时延设置。后面紧跟时间,时间格式为:ss.tt(second.tenths)。设定刷新时延。在交互命令中可以使用d或s进行修改。
-n:循环次数。最大循环次数,当达到时top将退出。
-p:监控pid。监控指定进程,使用pid,最多可以监控20个进程。
栏位显示:
a:PID-进程id
b:PPID-父进程ID
c:RUSER-实际用户名
d:UID-用户ID
e:USER-用户名
f:GROUP-组名
g:TTY-控制TTy。控制终端的名称。通常为进程发起设备(串口、pty等)。当显示?则表没有终端。
h:PR-优先级
i:NI-Nice值。
wikipedia中对Nice的解释
j:P-CPU使用。
k:CPU使用率
l:TIME-CPU时间。在累计时间模式下,每个进程都会记录自己的CPU时间(自己及自己子进程使用的时间)。
m:TIME+-CPU时间
n:MEM-内存使用率
o:VIRT-虚拟内存。
p:SWAP-
待续。