几个常用的ps命令

1. ps aux

If you are looking for a short summary of the active processes, use  ps aux

[root@rhel7 tmp]# ps aux |head
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root         1  0.0  0.3  44496  7124 ?        Ss   Jun27   0:01 /usr/lib/systemd/systemd --switched-root --system --deserialize 21
root         2  0.0  0.0      0     0 ?        S    Jun27   0:00 [kthreadd]
root         3  0.0  0.0      0     0 ?        S    Jun27   0:00 [ksoftirqd/0]
root         7  0.0  0.0      0     0 ?        S    Jun27   0:00 [migration/0]
root         8  0.0  0.0      0     0 ?        S    Jun27   0:00 [rcu_bh]
root         9  0.0  0.0      0     0 ?        S    Jun27   0:00 [rcuob/0]
root        10  0.0  0.0      0     0 ?        R    Jun27   0:00 [rcu_sched]
root        11  0.0  0.0      0     0 ?        S    Jun27   0:00 [rcuos/0]
root        12  0.0  0.0      0     0 ?        S    Jun27   0:00 [watchdog/0]

2. ps -ef 

If you are not only looking for the name of the process but also for the exact command that was used to start the process, use ps -ef .

[root@rhel7 tmp]# ps -ef |head
UID        PID  PPID  C STIME TTY          TIME CMD
root         1     0  0 Jun27 ?        00:00:01 /usr/lib/systemd/systemd --switched-root --system --deserialize 21
root         2     0  0 Jun27 ?        00:00:00 [kthreadd]
root         3     2  0 Jun27 ?        00:00:00 [ksoftirqd/0]
root         7     2  0 Jun27 ?        00:00:00 [migration/0]
root         8     2  0 Jun27 ?        00:00:00 [rcu_bh]
root         9     2  0 Jun27 ?        00:00:00 [rcuob/0]
root        10     2  0 Jun27 ?        00:00:00 [rcu_sched]
root        11     2  0 Jun27 ?        00:00:00 [rcuos/0]
root        12     2  0 Jun27 ?        00:00:00 [watchdog/0]

3.ps fax 

which shows hierarchical relationships between parent and child processes.

[root@rhel7 tmp]# ps fax | head
  PID TTY      STAT   TIME COMMAND
    2 ?        S      0:00 [kthreadd]
    3 ?        S      0:00  \_ [ksoftirqd/0]
    7 ?        S      0:00  \_ [migration/0]
    8 ?        S      0:00  \_ [rcu_bh]
    9 ?        S      0:00  \_ [rcuob/0]
   10 ?        R      0:00  \_ [rcu_sched]
   11 ?        S      0:00  \_ [rcuos/0]
   12 ?        S      0:00  \_ [watchdog/0]
   13 ?        S<     0:00  \_ [khelper]

 

posted on 2016-06-28 15:33  遠離塵世の方舟  阅读(294)  评论(0编辑  收藏  举报

导航