pstree is a command that shows the running processes as a tree. It is used as a more visual alternative to the ps command. The root of the tree is either init or the process with the given pid.
Syntax
pstree [options] [pid or username]
Example
$ pstree anand
gdm-x-session─┬─Xorg───9*[{Xorg}]
├─gnome-session-b─┬─ssh-agent
│ └─2*[{gnome-session-b}]
└─2*[{gdm-x-session}]
gnome-keyring-d─┬─ssh-agent
└─3*[{gnome-keyring-d}]
systemd─┬─(sd-pam)
├─at-spi-bus-laun─┬─dbus-daemon
│ └─3*[{at-spi-bus-laun}]
├─at-spi2-registr───2*[{at-spi2-registr}]
├─chrome─┬─2*[cat]
│ ├─chrome───chrome───12*[{chrome}]
│ ├─chrome─┬─chrome─┬─18*[chrome───10*[{chrome}]]
│ │ │ ├─chrome───5*[{chrome}]
│ │ │ ├─2*[chrome───12*[{chrome}]]
│ │ │ └─chrome───14*[{chrome}]
│ │ └─nacl_helper
│ ├─chrome───8*[{chrome}]
│ ├─chrome───6*[{chrome}]
│ └─23*[{chrome}]
├─chrome_crashpad───2*[{chrome_crashpad}]
├─chrome_crashpad───{chrome_crashpad}
├─dbus-daemon
├─dconf-service───2*[{dconf-service}]
├─evolution-addre───5*[{evolution-addre}]
├─evolution-calen───8*[{evolution-calen}]
├─evolution-sourc───3*[{evolution-sourc}]
├─gjs───6*[{gjs}]
├─gnome-session-b─┬─anydesk───7*[{anydesk}]
│ ├─evolution-alarm───5*[{evolution-alarm}]
│ ├─gsd-disk-utilit───2*[{gsd-disk-utilit}]
│ ├─update-notifier───3*[{update-notifier}]
│ └─3*[{gnome-session-b}]
├─gnome-session-c───{gnome-session-c}
├─gnome-shell─┬─ibus-daemon─┬─ibus-dconf───3*[{ibus-dconf}]
│ │ ├─ibus-engine-sim───2*[{ibus-engine-sim}]
│ │ ├─ibus-extension-───3*[{ibus-extension-}]
│ │ └─2*[{ibus-daemon}]
│ └─12*[{gnome-shell}]
├─gnome-shell-cal───5*[{gnome-shell-cal}]
├─gnome-terminal-─┬─bash───pstree
│ └─4*[{gnome-terminal-}]
├─goa-daemon───3*[{goa-daemon}]
├─goa-identity-se───2*[{goa-identity-se}]
├─gsd-a11y-settin───3*[{gsd-a11y-settin}]
├─gsd-color───3*[{gsd-color}]
├─gsd-datetime───3*[{gsd-datetime}]
├─gsd-housekeepin───3*[{gsd-housekeepin}]
├─gsd-keyboard───3*[{gsd-keyboard}]
├─gsd-media-keys───3*[{gsd-media-keys}]
├─gsd-power───3*[{gsd-power}]
├─gsd-print-notif───2*[{gsd-print-notif}]
├─gsd-printer───2*[{gsd-printer}]
├─gsd-rfkill───2*[{gsd-rfkill}]
├─gsd-screensaver───2*[{gsd-screensaver}]
├─gsd-sharing───3*[{gsd-sharing}]
├─gsd-smartcard───4*[{gsd-smartcard}]
├─gsd-sound───3*[{gsd-sound}]
├─gsd-usb-protect───3*[{gsd-usb-protect}]
├─gsd-wacom───2*[{gsd-wacom}]
├─gsd-wwan───3*[{gsd-wwan}]
├─gsd-xsettings───3*[{gsd-xsettings}]
├─gvfs-afc-volume───3*[{gvfs-afc-volume}]
├─gvfs-goa-volume───2*[{gvfs-goa-volume}]
├─gvfs-gphoto2-vo───2*[{gvfs-gphoto2-vo}]
├─gvfs-mtp-volume───2*[{gvfs-mtp-volume}]
├─gvfs-udisks2-vo───3*[{gvfs-udisks2-vo}]
├─gvfsd─┬─gvfsd-trash───2*[{gvfsd-trash}]
│ └─2*[{gvfsd}]
├─gvfsd-fuse───5*[{gvfsd-fuse}]
├─gvfsd-metadata───2*[{gvfsd-metadata}]
├─ibus-portal───2*[{ibus-portal}]
├─ibus-x11───2*[{ibus-x11}]
├─pulseaudio───3*[{pulseaudio}]
├─snap-store───4*[{snap-store}]
├─tracker-miner-f───4*[{tracker-miner-f}]
├─xdg-desktop-por───4*[{xdg-desktop-por}]
├─xdg-desktop-por───3*[{xdg-desktop-por}]
├─xdg-document-po───5*[{xdg-document-po}]
└─xdg-permission-───2*[{xdg-permission-}]
pstree Inspect a Process
$ pstree 7459
chrome───14*[{chrome}]pstree Default Output
$ pstree
systemd─┬─ModemManager───2*[{ModemManager}]
├─NetworkManager───2*[{NetworkManager}]
├─accounts-daemon───2*[{accounts-daemon}]
├─acpid
├─anydesk───3*[{anydesk}]
├─anydesk───2*[{anydesk}]
├─apache2───5*[apache2]
├─at-spi-bus-laun─┬─dbus-daemon
│ └─3*[{at-spi-bus-laun}]
├─at-spi2-registr───2*[{at-spi2-registr}]
├─avahi-daemon───avahi-daemon
├─bluetoothd
├─colord───2*[{colord}]
├─containerd───9*[{containerd}]
├─cron
├─cups-browsed───2*[{cups-browsed}]
├─cupsd
├─dbus-daemon
├─dconf-service───2*[{dconf-service}]
├─dnsmasq───dnsmasq
├─dockerd───9*[{dockerd}]
├─fwupd───4*[{fwupd}]
├─gdm3─┬─gdm-session-wor─┬─gdm-x-session─┬─Xorg───9*[{Xorg}]
│ │ │ ├─dbus-run-sessio─┬─dbus-daemon
│ │ │ │ └─gnome-session-b─┬─gnome-shell─┬─ibus-daemon─┬─ibus-dconf───3*[{ibus-dconf}]
│ │ │ │ │ │ ├─ibus-engine-sim───2*[{ibus-engine-sim}]
│ │ │ │ │ │ └─2*[{ibus-daemon}]
│ │ │ │ │ └─11*[{gnome-shell}]
│ │ │ │ ├─gsd-a11y-settin───3*[{gsd-a11y-settin}]
│ │ │ │ ├─gsd-color───3*[{gsd-color}]
│ │ │ │ ├─gsd-datetime───3*[{gsd-datetime}]
│ │ │ │ ├─gsd-housekeepin───3*[{gsd-housekeepin}]
│ │ │ │ ├─gsd-keyboard───3*[{gsd-keyboard}]
│ │ │ │ ├─gsd-media-keys───3*[{gsd-media-keys}]
│ │ │ │ ├─gsd-power───3*[{gsd-power}]
│ │ │ │ ├─gsd-print-notif───2*[{gsd-print-notif}]
│ │ │ │ ├─gsd-rfkill───2*[{gsd-rfkill}]
│ │ │ │ ├─gsd-screensaver───2*[{gsd-screensaver}]
│ │ │ │ ├─gsd-sharing───3*[{gsd-sharing}]
│ │ │ │ ├─gsd-smartcard───4*[{gsd-smartcard}]
│ │ │ │ ├─gsd-sound───3*[{gsd-sound}]
│ │ │ │ ├─gsd-wacom───2*[{gsd-wacom}]
│ │ │ │ └─3*[{gnome-session-b}]
│ │ │ └─2*[{gdm-x-session}]
│ │ └─2*[{gdm-session-wor}]
│ ├─gdm-session-wor─┬─gdm-x-session─┬─Xorg───9*[{Xorg}]
│ │ │ ├─gnome-session-b─┬─ssh-agent
│ │ │ │ └─2*[{gnome-session-b}]
│ │ │ └─2*[{gdm-x-session}]
│ │ └─2*[{gdm-session-wor}]
│ └─2*[{gdm3}]
├─gjs───6*[{gjs}]
├─gnome-keyring-d─┬─ssh-agent
│ └─3*[{gnome-keyring-d}]
├─gsd-printer───2*[{gsd-printer}]
├─ibus-portal───2*[{ibus-portal}]
├─ibus-x11───2*[{ibus-x11}]
├─irqbalance───{irqbalance}
├─2*[kerneloops]
├─libvirtd───16*[{libvirtd}]
├─networkd-dispat
├─polkitd───2*[{polkitd}]
├─pulsesecure───5*[{pulsesecure}]
├─rsyslogd───3*[{rsyslogd}]
├─rtkit-daemon───2*[{rtkit-daemon}]
├─snapd───20*[{snapd}]
├─switcheroo-cont───2*[{switcheroo-cont}]
├─systemd─┬─(sd-pam)
│ ├─dbus-daemon
│ ├─goa-daemon───3*[{goa-daemon}]
│ ├─goa-identity-se───2*[{goa-identity-se}]
│ ├─gvfs-afc-volume───3*[{gvfs-afc-volume}]
│ ├─gvfs-goa-volume───2*[{gvfs-goa-volume}]
│ ├─gvfs-gphoto2-vo───2*[{gvfs-gphoto2-vo}]
│ ├─gvfs-mtp-volume───2*[{gvfs-mtp-volume}]
│ ├─gvfs-udisks2-vo───3*[{gvfs-udisks2-vo}]
│ ├─gvfsd───2*[{gvfsd}]
│ ├─gvfsd-fuse───5*[{gvfsd-fuse}]
│ ├─pulseaudio───3*[{pulseaudio}]
│ └─tracker-miner-f───4*[{tracker-miner-f}]
├─systemd─┬─(sd-pam)
│ ├─at-spi-bus-laun─┬─dbus-daemon
│ │ └─3*[{at-spi-bus-laun}]
│ ├─at-spi2-registr───2*[{at-spi2-registr}]
│ ├─chrome─┬─2*[cat]
│ │ ├─chrome───chrome───12*[{chrome}]
│ │ ├─chrome─┬─chrome─┬─18*[chrome───10*[{chrome}]]
│ │ │ │ ├─2*[chrome───4*[{chrome}]]
│ │ │ │ ├─chrome───13*[{chrome}]
│ │ │ │ └─chrome───9*[{chrome}]
│ │ │ └─nacl_helper
│ │ ├─chrome───8*[{chrome}]
│ │ ├─chrome───5*[{chrome}]
│ │ └─22*[{chrome}]
│ ├─chrome_crashpad───2*[{chrome_crashpad}]
│ ├─chrome_crashpad───{chrome_crashpad}
│ ├─dbus-daemon
│ ├─dconf-service───2*[{dconf-service}]
│ ├─evolution-addre───5*[{evolution-addre}]
│ ├─evolution-calen───8*[{evolution-calen}]
│ ├─evolution-sourc───3*[{evolution-sourc}]
│ ├─gjs───6*[{gjs}]
│ ├─gnome-session-b─┬─anydesk───7*[{anydesk}]
│ │ ├─evolution-alarm───5*[{evolution-alarm}]
│ │ ├─gsd-disk-utilit───2*[{gsd-disk-utilit}]
│ │ ├─update-notifier───3*[{update-notifier}]
│ │ └─3*[{gnome-session-b}]
│ ├─gnome-session-c───{gnome-session-c}
│ ├─gnome-shell─┬─ibus-daemon─┬─ibus-dconf───3*[{ibus-dconf}]
│ │ │ ├─ibus-engine-sim───2*[{ibus-engine-sim}]
│ │ │ ├─ibus-extension-───3*[{ibus-extension-}]
│ │ │ └─2*[{ibus-daemon}]
│ │ └─12*[{gnome-shell}]
│ ├─gnome-shell-cal───5*[{gnome-shell-cal}]
│ ├─gnome-terminal-─┬─bash───pstree
│ │ └─4*[{gnome-terminal-}]
│ ├─goa-daemon───3*[{goa-daemon}]
│ ├─goa-identity-se───2*[{goa-identity-se}]
│ ├─gsd-a11y-settin───3*[{gsd-a11y-settin}]
│ ├─gsd-color───3*[{gsd-color}]
│ ├─gsd-datetime───3*[{gsd-datetime}]
│ ├─gsd-housekeepin───3*[{gsd-housekeepin}]
│ ├─gsd-keyboard───3*[{gsd-keyboard}]
│ ├─gsd-media-keys───3*[{gsd-media-keys}]
│ ├─gsd-power───3*[{gsd-power}]
│ ├─gsd-print-notif───2*[{gsd-print-notif}]
│ ├─gsd-printer───2*[{gsd-printer}]
│ ├─gsd-rfkill───2*[{gsd-rfkill}]
│ ├─gsd-screensaver───2*[{gsd-screensaver}]
│ ├─gsd-sharing───3*[{gsd-sharing}]
│ ├─gsd-smartcard───4*[{gsd-smartcard}]
│ ├─gsd-sound───3*[{gsd-sound}]
│ ├─gsd-usb-protect───3*[{gsd-usb-protect}]
│ ├─gsd-wacom───2*[{gsd-wacom}]
│ ├─gsd-wwan───3*[{gsd-wwan}]
│ ├─gsd-xsettings───3*[{gsd-xsettings}]
│ ├─gvfs-afc-volume───3*[{gvfs-afc-volume}]
│ ├─gvfs-goa-volume───2*[{gvfs-goa-volume}]
│ ├─gvfs-gphoto2-vo───2*[{gvfs-gphoto2-vo}]
│ ├─gvfs-mtp-volume───2*[{gvfs-mtp-volume}]
│ ├─gvfs-udisks2-vo───3*[{gvfs-udisks2-vo}]
│ ├─gvfsd─┬─gvfsd-trash───2*[{gvfsd-trash}]
│ │ └─2*[{gvfsd}]
│ ├─gvfsd-fuse───5*[{gvfsd-fuse}]
│ ├─gvfsd-metadata───2*[{gvfsd-metadata}]
│ ├─ibus-portal───2*[{ibus-portal}]
│ ├─ibus-x11───2*[{ibus-x11}]
│ ├─pulseaudio───3*[{pulseaudio}]
│ ├─snap-store───4*[{snap-store}]
│ ├─tracker-miner-f───4*[{tracker-miner-f}]
│ ├─xdg-desktop-por───4*[{xdg-desktop-por}]
│ ├─xdg-desktop-por───3*[{xdg-desktop-por}]
│ ├─xdg-document-po───5*[{xdg-document-po}]
│ └─xdg-permission-───2*[{xdg-permission-}]
├─systemd-journal
├─systemd-logind
├─systemd-machine
├─systemd-resolve
├─systemd-timesyn───{systemd-timesyn}
├─systemd-udevd───systemd-udevd
├─thermald───{thermald}
├─transmission-da───2*[{transmission-da}]
├─udisksd───4*[{udisksd}]
├─unattended-upgr───{unattended-upgr}
├─upowerd───2*[{upowerd}]
├─wpa_supplicant
└─xdg-permission-───2*[{xdg-permission-}]