pstree command

LINUX-Frequently used commands

pstree command View processes in a tree.
Syntax
pstree  [Option]  [Process ID or user name]
The pstree command displays the currently running processes in a tree..
The tree starts at 'pid', or 'init' if 'pid' is not specified.
If a user name is specified, a tree will be displayed starting from the user name..
Frequently used options
-a  Displays the command line arguments
-c  Do not group subtrees with the same content
-h  Highlight the current process and its ancestor processes
-l   Display long lines. By default, long lines are cut off at the width of the display
-n  Processes with the same parent are sorted by PID rather than by name
-p  Displays the PID
-u  Displays the user ID
Example: Tree view of parent-child relationship of processes (no options).
$ su -  ← Become a super user root
Password: Enter root password
#  pstree

Example: Display process ID.
$ su -  ← Become a super user root
Password: Enter root password
#  pstree  -u -p

Copied title and URL