Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

pstree Command in Linux with Examples

  • Difficulty Level : Expert
  • Last Updated : 03 Jun, 2020

Pstree command in Linux that shows the running processes as a tree which is a more convenient way to display the processes hierarchy and makes the output more visually appealing. The root of the tree is either init or the process with the given pid. Pstree can also be installed in other Unix systems.


pstree [options] [pid or username]

Working with Pstree Command

1. To display process tree




It produces process-related information in output.

2. To include command line arguments in output

pstree -a



We do this by using the “-a” command line option. This command now displays command line options for some processes.

3. To display PIDs

pstree -p



To display PIDs for each process name, we use “-p” option.

4. To force pstree to expand identical subtrees in output.

pstree -c



By default, the pstree command merges identical branches by putting them in square brackets and prefixing them with the repetition count. But we can also force the tool to expand identical trees, by using the “-c” command-line option.

5. To sort processes

pstree -n



If we want to sort processes with the same ancestor by PID instead of by name i.e. numeric sort, we use “-n” option.

6. To see who is the owner/user of a process

pstree -u



If we want to find out the owner of a process in parenthesis, use the “-u” option.

7. To highlight the current process or any other process

pstree -h



To highlight the current process and its ancestors use “-h” option. It highlights the specified process (by name/pid)

8. To show process group IDs in output

pstree -g


We can see that process group IDs are shown as decimal numbers in parentheses after each process name.

9. To make pstree display process tree specific to a user.

pstree khushi


It we want to display all process trees rooted at processes owned by a specific user, for this, we have to pass the name of that user as input to the command.

10. To display version information.

pstree -V


When we want to display version information we use “-V” option.

My Personal Notes arrow_drop_up
Recommended Articles
Page :