【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的解釋
k:CPU使用率
l:TIME-CPU時間。在累計時間模式下,每個進程都會記錄自己的CPU時間(自己及自己子進程使用的時間)。
m:TIME+-CPU時間
n:MEM-內存使用率
o:VIRT-虛擬內存。
p:SWAP-
待續。