ITeye博客

Linux中的PS命令

beagoodboy · 2010-12-31 14:12 · 操作系统 · Unix · F# · Linux · thread · Markdown

ps命令显示选定进程的当前信息。默认地,ps选取当前用户一致的有效用户ID的所有进程,并与当前的终端相关的。它显示进程ID、终端、CPU时间、可执行文件名。BSD-style选项会添加进程状态到默认显示中,同时还将与当前用户相关的其他终端进程显示出来。

三种类型的命令行选项: 1、UNIX选项,可以组合,必须以短横打头 2、BSD选项,可以组合,不能以短横打头 3、GUN长选项,以两个短横打头 不同风格的选项可以混用,但可能会有冲突。

简单进程选择: -e 所有进程

通过列表选择进程: -p pidlist 通过进程ID

输出格式控制: -f 全格式输出 -o format 用户定义格式

输出修饰: -H 进程树 f ASCII艺术的进程树

线程显示: -m 在进程后显示线程

进程标识符(F栏,flags输出限定符): 1 forked but didn't exec 4 used super-user privileges

进程状态码: D Uninterruptible sleep (usually IO) R Running or runnable (on run queue) S Interruptible sleep (waiting for an event to complete) T Stopped, either by a job control signal or because it is being traced. W paging (not valid since the 2.6.xx kernel) X dead (should never be seen) Z Defunct ("zombie") process, terminated but not reaped by its parent.

如果是BSD格式的话,还会显示 < high-priority (not nice to other users) N low-priority (nice to other users) L has pages locked into memory (for real-time and custom IO) s is a session leader l is multi-threaded (using CLONE_THREAD, like NPTL pthreads do)

  • is in the foreground process group

标准输入限定符: CODE HEADER DESCRIPTION %cpu %CPU cpu使用率 %mem %MEM resident set size与物理内存的比率 args COMMAND 命令以及它的参数 comm COMMAND 仅命令行 euid EUID effective user ID. (alias uid). ni NI nice value. This ranges from 19 (nicest) to -20 (not nice to others) ppid PPID parent process ID. rss RSS resident set size, the non-swapped physical memory has used (in KB) rtprio RTPRIO realtime priority. time TIME cumulative CPU time, "[dd-]hh:mm:ss" format. (alias cputime). vsize VSZ virtual memory usage of process. vm_lib + vm_exe + vm_data + vm_stack

后记: 以上是man ps的阅读笔记,发现一个ps命令也非常复杂,平时只是学到了几种选项的写法,但是PS的所有选项是如何组织的?都可以用来查看哪些信息呢?

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。