The Pstree command is a command that looks at the process tree or structure
[Email protected]~] #pstree [options] Note that the-P and-u cannot be used at the same time if the former is invalid but not an error
Options:
-P: Show PID of the process
-U: Shows the user who owns the process
1 [email protected] opt]# Pstree2 INIT─┬─ABRTD3 ├─acpid4 ├─atd5 ├─AUDITD───{AUDITD}6├─automount───4*[{automount}]7 ├─certmonger8 ├─crond9 ├─CUPSDTen├─dbus-daemon───{dbus-Daemon} One├─hald───hald-runner─┬─hald-addon-ACPI A│└─hald-addon-Inpu - ├─master─┬─pickup - │└─qmgr the ├─mcelog -├─6*[Mingetty] - ├─RPC.IDMAPD - ├─rpc.statd + ├─rpcbind -├─rsyslogd───3*[{RSYSLOGD}] + ├─sshd─┬─sshd───bash───pstree A │└─sshd───sshd───bash at└─udevd───2*[UDEVD]
or pstree-p.
1[Email protected] opt]# Pstree-P2Init1) ─┬─ABRTD (1582)3├─acpid (1378)4├─ATD (1601)5├─AUDITD (1124) ───{AUDITD} (1125)6├─automount (1454) ─┬─{automount} (1455)7│├─{automount} (1456)8│├─{automount} (1459)9│└─{automount} (1462)Ten├─certmonger (1614) One├─crond (1590) A├─CUPSD (1353) -├─dbus-daemon (1336) ───{dbus-daemon} (1339) -├─hald (1387) ───hald-runner (1388) ─┬─HALD-ADDON-ACPI (1431) the│└─hald-addon-inpu (1416) -├─master (1558) ─┬─pickup (2256) -│└─qmgr (1572) -├─mcelog (1470) +├─mingetty (1630) -├─mingetty (1632) +├─mingetty (1634) A├─mingetty (1636) at├─mingetty (1638) -├─mingetty (1644) -├─RPC.IDMAPD (1241) -├─RPC.STATD (1209) -├─rpcbind (1191) -├─RSYSLOGD (1149) ─┬─{rsyslogd} (1150) in│├─{RSYSLOGD} (1152) -│└─{RSYSLOGD} (1153) to├─sshd (1482) ─┬─sshd (1647) ───bash (1652) ───pstree (2649) +│└─sshd (2585) ───sshd (2589) ───bash (2590) -└─UDEVD (466) ─┬─UDEVD (1645) the└─UDEVD (1646)
or Pstree-u.
1[Email protected] opt]# Pstree-u2 INIT─┬─ABRTD3 ├─acpid4 ├─atd5 ├─AUDITD───{AUDITD}6├─automount───4*[{automount}]7 ├─certmonger8 ├─crond9 ├─CUPSDTen├─dbus-daemon (Dbus) ───{dbus-Daemon} One├─hald (Haldaemon) ───hald-runner (root) ─┬─hald-addon-ACPI (Haldaemon) A│└─hald-addon-Inpu - ├─master─┬─pickup (postfix) - │└─qmgr (postfix) the ├─mcelog -├─6*[Mingetty] - ├─RPC.IDMAPD - ├─rpc.statd (Rpcuser) + ├─rpcbind (RPC) -├─rsyslogd───3*[{RSYSLOGD}] + ├─sshd─┬─sshd───bash───pstree A │└─sshd───sshd (Fengtaotao) ───bash at└─udevd───2*[UDEVD]
View Code
Linux Server Management: The system's process Management Pstree command