Skip to content

pstree command on Linux (list processes)

The pstree command on Linux will show the entire process tree from init or systemd to the last running process. It is similar to the ps —auxf command. It is useful for understanding the hierarchy of processes in Linux.

In addition to the options below, pstree can show the hierarchy pertaining to a specific user or process through its PID.

-a: This option shows the command line used to start the processes;

-c: Disables the function of merging identical processes at the same hierarchy level;

-G: Uses the VT100 format to show lines between processes instead of keyboard characters;

-h: Highlights the processes connected to the terminal at the exact moment;

-p: Includes the PID of the processes in the list.

Example:

$ pstree -G -c -p <br></br>systemd (1) ??acpid (2813) ? <br></br><br></br>?agetty (2674) <br></br>$?agetty (2675) <br></br>$??atd (2570) ?auditd (1884) <br></br>???? {<br></br>auditd} (1885) 496 <br></br><br></br>?dhclient (2211) ? <br></br>?firewalld (1915) ??? {firewalld} (2274) ? <br></br>?nginx (10982) ??nginx (10983)

? ? ?nginx (10984)
? ??nginx (10985
) ? ?php-fpm (2387)
??php-fpm (2412)
? ? ?php-fpm (2413) ? ñ

php-fpm (30458) suo ?rsyslogd (2542) ?? {rsyslogd} (2559) ? syslogd} (2744) 496 — systemd-journal (1421) Learn much more about Linux in our online course. You can register here. If you already have an account, or want to create one, just log in or create your user here.

Did you like it?

Share