• 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. needrestart: command not found
  2. top Command Examples in Linux
  3. apport-bug Command Examples in Linux
  4. sbatch: command not found
  5. pw-cli Command Examples in Linux
  6. certbot: command not found
  7. git info: Display Git repository information
  8. goaccess: command not found
  9. checkupdates: command not found
  10. mt: command not found

You May Also Like

Primary Sidebar

Recent Posts

  • gixy Command Examples
  • gitsome Command Examples
  • gitmoji Command Examples
  • gitlint Command Examples

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright