• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

pstree: command not found

by admin

pstree command displays a hierarchical list of processes in a tree format. pstree is very handy for understanding how parent/child process relationships are set up.

If the PID is specified, the displayed tree is rooted at that process. Otherwise, it is rooted at the init process, which has PID 1. If a user (a valid username) is specified, trees for all processes owned by user are shown. The tree is represented using characters that appear as lines, such as | for vertical lines and + for intersections (VT100 line-drawing characters, displayed as solid lines by most terminals, are optional).

The command can be run without providing any options.

$ pstree

To display tree of processes with their PIDs, use the -p switch.

# pstree -p
init(1)-+-atd(468)
        |-bdflush(5)
        |-crond(454)
        |-httpd(440)-+-httpd(450)
        |            |-httpd(451)
        |            |-httpd(452)
        |            |-httpd(453)
        |            |-httpd(455)
        |            |-httpd(456)
        |            |-httpd(457)
        |            '-httpd(458)
        |-keventd(2)
        |-kjournald(7)
        |-klogd(335)
        |-ksoftirqd_CPU0(3)
        |-kswapd(4)
        |-kupdated(6)
        |-login(475)---bash(478)---pstree(518)
        |-sendmail(420)
        |-sshd(385)
        |-syslogd(330)
        '-xinetd(402)

If you encounter the below error while running the pstree command:

pstree: command not found

you may try installing the package as shown below as per your choice of distribution.

Distribution Command
OS X brew install pstree
Debian apt-get install psmisc
Ubuntu apt-get install psmisc
Alpine apk add psmisc
Arch Linux pacman -S psmisc
Kali Linux apt-get install psmisc
CentOS yum install psmisc
Fedora dnf install psmisc
Raspbian apt-get install psmisc

pstree Command Examples

1. Display a tree of processes:

# pstree

2. Display a tree of processes with PIDs:

# pstree -p

3. Display all process trees rooted at processes owned by specified user:

# pstree user

Filed Under: Linux

Some more articles you might also be interested in …

  1. setxkbmap: command not found
  2. jarsigner: command not found
  3. How to Configure Device File owner/group with udev rules
  4. What is the difference between & (ampersand) and && (double ampersand) while executing simultaneous commands on Linux
  5. CentOS / RHEL 6 : Install and Configure SNMPv3
  6. libreoffice Command Examples in Linux
  7. qsub: command not found
  8. route Command Examples in Linux
  9. mktemp: command not found
  10. Unable to start Nagios Service (CentOS/RHEL)

You May Also Like

Primary Sidebar

Recent Posts

  • aws ec2: CLI for AWS EC2 (Command Examples)
  • aws cur – Create, query, and delete AWS usage report definitions (Command Examples)
  • aws configure – Manage configuration for the AWS CLI (Command Examples)
  • aws cognito-idp: Manage Amazon Cognito user pool and its users and groups using the CLI

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright