Display processes including their parent-child relationships.

Display processes including their parent-child relationships.

To display the parent-child relationship of processes, run the ps command with the option “-f”.

Processes in a parent-child relationship will be displayed in a hierarchical manner.

root@Lion:~# ps -axf
  PID TTY      STAT   TIME COMMAND
    2 ?        S      0:00 [kthreadd]
    3 ?        I<     0:00  \_ [rcu_gp]
    4 ?        I<     0:00  \_ [rcu_par_gp]
    6 ?        I<     0:00  \_ [kworker/0:0H-kblockd]
    8 ?        I<     0:00  \_ [mm_percpu_wq]
    9 ?        S      0:00  \_ [ksoftirqd/0]
   10 ?        I      0:27  \_ [rcu_sched]
   11 ?        I      0:00  \_ [rcu_bh]
   12 ?        S      0:01  \_ [migration/0]
   14 ?        S      0:00  \_ [cpuhp/0]
   15 ?        S      0:00  \_ [cpuhp/1]
   16 ?        S      0:01  \_ [migration/1]
   17 ?        S      0:00  \_ [ksoftirqd/1]
   19 ?        I<     0:00  \_ [kworker/1:0H-kblockd]
   20 ?        S      0:00  \_ [cpuhp/2]
 (abbreviation)
  688 ?        Ss     0:03 /lib/systemd/systemd-logind
  716 ?        Ssl    3:16 /usr/sbin/clamd –foreground=true
  718 ?        Ss     0:00 /usr/sbin/sshd -D
29917 ?        Ss     0:00  \_ sshd: nuy [priv]
29935 ?        S      0:00      \_ sshd: nuy@pts/0
29936 pts/0    Ss     0:00          \_ -bash
29939 pts/0    S      0:00              \_ su –
29940 pts/0    S      0:00                  \_ -bash
30036 pts/0    S      0:00                      \_ su –
30037 pts/0    S      0:00                          \_ -bash
30040 pts/0    S      0:00                              \_ su – nuy
30041 pts/0    S      0:00                                  \_ -bash
30120 pts/0    S      0:00                                      \_ su –
30121 pts/0    S      0:00                                          \_ -bash
30140 pts/0    R+     0:00                                              \_ ps -axf
  754 ?        Ss     0:24 /usr/sbin/apache2 -k start
28054 ?        S      0:00  \_ /usr/sbin/apache2 -k start
29734 ?        S      0:10  \_ /usr/sbin/apache2 -k start
29738 ?        S      0:11  \_ /usr/sbin/apache2 -k start
29742 ?        S      0:10  \_ /usr/sbin/apache2 -k start
29745 ?        S      0:09  \_ /usr/sbin/apache2 -k start
29767 ?        S      0:08  \_ /usr/sbin/apache2 -k start
30133 ?        S      0:00  \_ /usr/sbin/apache2 -k start
30134 ?        S      0:00  \_ /usr/sbin/apache2 -k start
30135 ?        S      0:00  \_ /usr/sbin/apache2 -k start
30136 ?        S      0:00  \_ /usr/sbin/apache2 -k start
30138 ?        S      0:00  \_ /usr/sbin/apache2 -k start
  757 ?        Sl    13:50 /usr/sbin/mysqld –daemonize –pid-file=/var/run/mysqld/mysqld.pid
11621 tty1     Ss+    0:00 /sbin/agetty -o -p — \u –noclear tty1 linux
16969 ?        Ss     0:00 /usr/sbin/vsftpd /etc/vsftpd.conf
29920 ?        Ss     0:00 /lib/systemd/systemd –user
29921 ?        S      0:00  \_ (sd-pam)

Information to be displayed
PID:A number that is automatically assigned to each process
TTY:Control terminal running the process
STAT:state
・Field 1
R:executable
T:Stopping or tracing
D:Dormant and uninterruptible.
S:dormant
Z:zombie(Not deleted, but suspended)
・Field 2
W:swapped out(No resident pages)
・Field 3
N:positive nice value
TIME:CPU consumption time
COMMAND:Execute command

タイトルとURLをコピーしました