Команди Linux

Linux Pstree Command Tutorial

Linux Pstree Command Tutorial

The best way to display the running process in a system is to display them as a tree hierarchy. In a Linux system, “pstree” helps visualize processes hierarchy which is a less complex way to display running processes.

The “pstree” command is one of the Linux commands that merge branches through square brackets and display the process as a tree. The root of the tree could be “init” or “pid”.

How to Use Pstree Commands in Linux

Type “pstree” command in terminal to display the hierarchy tree of all running process:

$ pstree

In the output, it displays the hierarchy tree structure in which systemd is the parent/root process of all the system process as it starts first when the system is booted.

Here are few examples to show the working of the “pstree” command in the Linux system:

You won't see command-line arguments in output by default, so, to display it in the terminal, use the given command:

$ pstree -a

When you use the “-p” with “pstree” command in the terminal, it will display PIDS in output as a decimal number within parenthesis.

$ pstree -p

The “-c” option is used to extend “pstree” as it packed down subtrees and to display identical subtrees use:

$ pstree -c

The “-n” option in “pstree” helps to sort process in numeric order:

$ pstree -n

To display the user of the process, use the “-u” option with “pstree” in the terminal.

$ pstree -u

The “-h” option in “pstree” allows to highlight the current process with its ancestors:

$ pstree -h

To print IDs of process groups in the terminal, use “-g”:

$ pstree -g

To get detailed information about the “pstree” version, type the “-V” command:

$ pstree -V

Conclusion

The pstree command in Linux is used to display the running process of a system in a tree hierarchy. It makes an interesting way to merge branches and visualize them. Through this tutorial, we have learned that how to use “pstree” commands with examples.

How to reverse Mouse and Touchpads scrolling direction in Windows 10
Mouse and Touchpads not only make computing easy but more efficient and less time-consuming. We cannot imagine a life without these devices, but still...
How to change Mouse pointer and cursor size, color & scheme on Windows 10
The mouse pointer and cursor in Windows 10 are very important aspects of the operating system. This can be said for other operating systems as well, s...
Безкоштовні ігри з відкритим кодом для розробки ігор Linux
У цій статті буде розглянуто перелік безкоштовних ігрових механізмів з відкритим кодом, які можна використовувати для розробки 2D та 3D ігор на Linux....