pstree command

pstree shows processes and their children like a tree

Typical usage: diagnosing process issues, information gathering, troubleshooting

Introduction into pstree

The pstree command is a tool for Linux systems to show active processes, including their hierarchy. When a process has child processes, it will be listed one level deeper. Due to the format it is called a tree.

Example output:

systemd─┬─agetty
        ├─auditd───{auditd}
        ├─cron
        ├─dbus-daemon
        ├─dhclient
        ├─dovecot─┬─anvil
        │         ├─config
        │         └─log
        ├─nginx───2*[nginx]
        ├─qemu-ga───{qemu-ga}
        ├─sshd─┬─sshd───sshd───bash───su───bash
        │      └─sshd───sshd───bash───su───bash───pstree
        ├─systemd───(sd-pam)
        ├─systemd-journal
        ├─systemd-logind
        ├─systemd-timesyn───{systemd-timesyn}
        └─systemd-udevd

Installation

When pstree is not installed by default, it can be added to the system using the relevant software package.

Package information for pstree

Operating systemPackage nameInstallation
AlmaLinuxpsmisc
dnf install psmisc
Arch Linuxpsmisc
pacman -S psmisc
Debianpsmisc
apt install psmisc
Fedorapsmisc
dnf install psmisc
Red Hat Enterprise Linuxpsmisc
dnf install psmisc
Rocky Linuxpsmisc
dnf install psmisc
openSUSEpsmisc
zypper install psmisc
Ubuntupsmisc
apt install psmisc

Your Linux distribution using a different package? Share your feedback.

Usage

Available options

Long optionShort optionDescription
--color ARG-CUse color in output. ARG can be 'age' which marks oldest, recent and new processes
--ns-sort=TYPE-N TYPEShow processes sorted by a namespace (ipc, mnt, net, pid, time, user, uts)
--show-pids-pInclude process ID (PID)

Missing an option in this overview? Share your feedback.

Frequently Asked Questions

What is the pstree command and its purpose?

The pstree command is a command-line tool to show which processes and their children in a visual representation like a tree.

Which package provides the pstree command?

The command pstree is provided by the psmisc package.

Related and similar commands

Linux has a lot of tools and commands available and sometimes you just need that little other tool. Here is a list of commands that are similar or related to pstree:

Related and similar commands to pstree
CommandCategorySummary
basenamefilesStrips directory and file name suffix from a given path
chrtprocessesSets Linux scheduler policy and priority for a process or command
killprocessesSending signals to processes
niceprocessesRuns commands with specified priority
numactlprocessesControls NUMA policy for processes and shared memory
peekfdprocessesTracks a process and show file descriptor activity
pidofprocessesReturns process IDs for a process name
pidstatmonitoringMonitoring CPU, memory, and disk activity
pidwaitprocessesWait for process to stop
pmapprocessesShows memory mapping of process
prtstatprocessesShows process details for selected process like state, CPU and memory usage
pscapcapabilitiesDisplay available capabilities for running processes
pslogloggingShows which log files a process has opened
pwdxprocessesShows current working directory of a process
reniceprocessesChanges the priority of running processes
slabtopmemoryShows slab usage of kernel
smemmemoryShow memory usage including swap
straceprocess inspectionInspects running process
unitsdata conversionConverts a unit into another one, like from Celcius to Fahrenheit
watchprocessesMonitors changes in output of specified command