pstree command

LINUX-Frequently used commands

pstree command View processes in a tree.
Syntax
pstree  [Option]  [Process ID or user name]
The pstree command displays the currently running processes in a tree..
The tree starts at ‘pid’, or ‘init’ if ‘pid’ is not specified.
If a user name is specified, a tree will be displayed starting from the user name..
Frequently used options
-a  Displays the command line arguments
-c  Do not group subtrees with the same content
-h  Highlight the current process and its ancestor processes
-l   Display long lines. By default, long lines are cut off at the width of the display
-n  Processes with the same parent are sorted by PID rather than by name
-p  Displays the PID
-u  Displays the user ID
Example: Tree view of parent-child relationship of processes (no options).
$ su –  ← Become a super user root
Password: Enter root password
#  pstree

systemd-+-NetworkManager---2*[{NetworkManager}]
        |-agetty
        |-auditd---{auditd}
        |-chronyd
        |-crond
        |-dbus-daemon---{dbus-daemon}
        |-firewalld---{firewalld}
        |-httpd---6*[httpd]
        |-master-+-pickup
        |        `-qmgr
        |-polkitd---5*[{polkitd}]
        |-rsyslogd---2*[{rsyslogd}]
        |-sshd-+-sshd---bash---pstree
        |      `-sshd---bash
        |-systemd-journal
        |-systemd-logind
        |-systemd-udevd
        `-tuned---4*[{tuned}]
Example: Display process ID.
$ su –  ← Become a super user root
Password: Enter root password
#  pstree  -u -p

systemd(1)-+-NetworkManager(532)-+-{NetworkManager}(559)
           |                     `-{NetworkManager}(566)
           |-agetty(1198)
           |-auditd(11383)---{auditd}(11384)
           |-chronyd(11477)
           |-crond(11417)
           |-dbus-daemon(496)---{dbus-daemon}(501)
           |-firewalld(2478)---{firewalld}(2603)
           |-httpd(11771)-+-httpd(1216)
           |              |-httpd(1217)
           |              |-httpd(1218)
           |              |-httpd(1219)
           |              |-httpd(1220)
           |              `-httpd(1413)
           |-master(1070)-+-pickup(18803)
           |              `-qmgr(1078)
           |-polkitd(11554)-+-{polkitd}(11555)
           |                |-{polkitd}(11556)
           |                |-{polkitd}(11557)
           |                |-{polkitd}(11558)
           |                `-{polkitd}(11559)
           |-rsyslogd(11355)-+-{rsyslogd}(11357)
           |                 `-{rsyslogd}(11358)
           |-sshd(2585)-+-sshd(19478)---bash(19490)---pstree(21540)
           |            `-sshd(20786)---bash(20791)
           |-systemd-journal(349)
           |-systemd-logind(504)
           |-systemd-udevd(1455)
           `-tuned(11630)-+-{tuned}(11636)
タイトルとURLをコピーしました