How to Display PPIDs in Linux

In Linux, PPID refers to the process ID of the parent process. A parent process in Linux is the one that is capable of spawning child processes. A single parent process can have multiple child processes whereas a single child process can belong to one and only one parent process. In other words, multiple child processes can have the same PPID. In today’s tutorial, we want to show you the two methods of finding the parent process IDs or PPIDs in Linux.

Displaying PPIDs in Linux

For displaying the parent process IDs or PPIDs in Linux, you can choose any of the following two methods:

Method # 1: Using the “pstree” command

For displaying the PPIDs through the “pstree” command, you will have to execute it in the manner shown below:

$ pstree -p

pstree command

When this command will be executed, it will display all the currently running parent processes and their child processes in a nice tree-like structure along with their respective IDs. The PPIDs are represented by the numbers on the first level of the hierarchy. For example, the PPID of the ModemManager parent process is 751 as shown in the following image:

Show PPID using pstree

Method # 2: Using the “ps” command

For displaying the PPIDs through the “ps” command, you will have to execute it in the manner shown below:

$ ps -ef

ps -ef

When this command will be executed, it will display all the currently running parent processes and some additional information about them in the form of an organized table along with their respective IDs. The PPIDs are displayed in the third column of the output. For example, the PPID of the /sbin/init splash process is 0 as shown in the following image:

Show parent process ID using ps command

Conclusion:

We shared with you the two different methods of displaying the parent process IDs or PPIDs in Linux. For following both of these methods, you are just supposed to run a one-liner command and you will be good to go.