Linux-komennot

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.

Viisi parasta pelin kaappauskorttia
Olemme kaikki nähneet ja rakastaneet suoratoistopelejä YouTubessa. PewDiePie, Jakesepticye ja Markiplier ovat vain joitain huippupelaajista, jotka ova...
How to Develop a Game on Linux
A decade ago, not many Linux users would predict that their favorite operating system would one day be a popular gaming platform for commercial video ...
Open Source Ports of Commercial Game Engines
Free, open source and cross-platform game engine recreations can be used to play old as well as some of the fairly recent game titles. This article wi...