Linux ps -ef和ps aux的区别

Linux ps -ef和ps aux的区别

ps -ef 是用标准的格式显示进程的、其格式如下

monarch-t@monarcht-pc:/$ ps -ef
UID         PID   PPID  C STIME TTY          TIME CMD
root          1      0  0 17:00 ?        00:00:03 /sbin/init
root          2      0  0 17:00 ?        00:00:00 [kthreadd]
root          3      2  0 17:00 ?        00:00:00 [ksoftirqd/0]
root          5      2  0 17:00 ?        00:00:00 [kworker/0:0H]
root          7      2  0 17:00 ?        00:00:01 [rcu_sched]
root          8      2  0 17:00 ?        00:00:00 [rcu_bh]
root          9      2  0 17:00 ?        00:00:00 [migration/0]
root         10      2  0 17:00 ?        00:00:00 [watchdog/0]
root         11      2  0 17:00 ?        00:00:00 [watchdog/1]
root         12      2  0 17:00 ?        00:00:00 [migration/1]
... ...

其中各列的内容意思如下
UID //用户ID、但输出的是用户名
PID //进程的ID
PPID //父进程ID
C //进程占用CPU的百分比
STIME //进程启动到现在的时间
TTY //该进程在那个终端上运行,若与终端无关,则显示? 若为pts/0等,则表示由网络连接主机进程。
CMD //命令的名称和参数


ps aux 是用BSD的格式来显示、其格式如下

monarch-t@monarcht-pc:/$ ps -aux
USER        PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root          1  0.1  0.1  34032  4572 ?        Ss   17:00   0:03 /sbin/init
root          2  0.0  0.0      0     0 ?        S    17:00   0:00 [kthreadd]
root          3  0.0  0.0      0     0 ?        S    17:00   0:00 [ksoftirqd/0]
root          5  0.0  0.0      0     0 ?        S<   17:00   0:00 [kworker/0:0H]
root          7  0.0  0.0      0     0 ?        S    17:00   0:01 [rcu_sched]
root          8  0.0  0.0      0     0 ?        S    17:00   0:00 [rcu_bh]
root          9  0.0  0.0      0     0 ?        S    17:00   0:00 [migration/0]
root         10  0.0  0.0      0     0 ?        S    17:00   0:00 [watchdog/0]
root         11  0.0  0.0      0     0 ?        S    17:00   0:00 [watchdog/1]
root         12  0.0  0.0      0     0 ?        S    17:00   0:00 [migration/1]
root         13  0.0  0.0      0     0 ?        S    17:00   0:00 [ksoftirqd/1]

同ps -ef 不同的有列有
USER //用户名
%CPU //进程占用的CPU百分比
%MEM //占用内存的百分比
VSZ //该进程使用的虚拟內存量(KB)
RSS //该进程占用的固定內存量(KB)(驻留中页的数量)
STAT //进程的状态
START //该进程被触发启动时间
TIME //该进程实际使用CPU运行的时间

猜你喜欢

转载自www.cnblogs.com/Monarch-T/p/10388522.html