pstree – Display the Derivation Relationship Between Processes in the Form of a Tree Diagram

The pstree command is used to display the relationship between processes in the form of a tree diagram. It is a useful tool for system administrators to visualize the hierarchy of processes running on a Linux system.


The pstree command is used to display a tree diagram of processes on a Linux system. By default, pstree shows the entire process hierarchy, starting from the init process (PID 1). Each process is displayed as a node in the tree, and child processes are indented beneath their parent process.


The basic syntax for the pstree command is as follows:

pstree [options] [pid]


To display the entire process hierarchy, simply run the pstree command with no arguments:

$ pstree

This will display a tree diagram of all processes running on the system.

To display the process hierarchy for a specific process, use the PID of that process as an argument:

$ pstree 1234

This will display the process hierarchy for the process with PID 1234.

Use Cases

The pstree command is useful for a variety of system administration tasks, including:

  • Troubleshooting system performance issues
  • Monitoring resource usage by processes
  • Identifying processes that are consuming excessive resources
  • Understanding the relationship between processes on a system


The pstree command has several options that can be used to customize its behavior. These options are summarized in the following table:

Option Description
-a Show command line arguments for each process
-c Do not compress identical subtrees
-h Highlight the current process and its ancestors
-l Show process command line arguments in full
-n Sort the process tree by PID instead of process name
-p Show process PIDs in addition to process names
-u Show user names in addition to process names

Troubleshooting tips

If you encounter issues with the pstree command, the following tips may help:

  • If the output is too long to fit on a single screen, consider piping the output to less for easier navigation: pstree | less
  • If the output is difficult to read due to overlapping lines, try increasing the width of your terminal window or using a wider font.
  • If you receive an error message indicating that the pstree command is not found, make sure that it is installed on your system. On Debian-based systems, you can install it using the following command: sudo apt-get install psmisc


  • The pstree command is part of the psmisc package, which may need to be installed on some Linux distributions.
  • The pstree command can be used in conjunction with other commands, such as grep or awk, to filter or manipulate the output as needed.