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

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • VCS
  • Interview Questions
  • Database
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

pstree Command Examples in Linux

by admin

pstree command is used to display the parent-child relationship in a hierarchical format. The output of this command is quite similar to the output of the ‘ps axjf’ command and the ‘ps -ef –forest’ command, as shown in the following command line:

$ pstree

The following screenshot displays the tree hierarchy of a single process with PID using the pstree command:

pstree Command Examples in Linux

Display the tree hierarchy of a user’s processes by executing the command line given:

$ pstree -p geek

On execution of the preceding command, the PIDs assigned to each process are shown in parentheses after each process name.

pstree Command Example

1. To display the process tree:

# pstree 2210 

2. To show the command line arguments:

# pstree -a 

3. To Use ASCII characters to draw the tree:

# pstree -A 

4. To Disable compaction of identical subtrees:

# pstree -c 

5. To Use VT100 line drawing characters:

# pstree -G 

6. To Highlight the current process and its ancestors:

# pstree -h 

7. To highlight the specified process instead:

# pstree -H 

8. To Display long lines:

# pstree -l 

9. To Sort processes with the same ancestor by PID instead of by name:

# pstree -n 

10. To show PIDs:

# pstree -p 

11. To show the uid transactions:

# pstree -u 

12. To Use UTF-8 (Unicode) line drawing characters:

# pstree -U 

13. To display the version:

# pstree -V 

14. To show the security context:

# pstree -Z 

Filed Under: Linux

Some more articles you might also be interested in …

  1. mkinitrd: command not found
  2. gpg-zip Command Examples
  3. Shell Script to print pyramid of Stars
  4. Linux OS Service ‘hplip’
  5. bmaptool Command Examples (Create or copy block maps intelligently)
  6. apropos – Search the manual pages for names and descriptions (Command Examples)
  7. “git submodule” Command Examples
  8. getfacl: command not found
  9. aplay Command Examples in Linux
  10. fls: List files and directories in an image file or device

You May Also Like

Primary Sidebar

Recent Posts

  • Vanilla OS 2 Released: A New Era for Linux Enthusiasts
  • mk Command Examples
  • mixxx Command Examples
  • mix Command Examples

© 2025 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright