How to view PPIDs on Linux

s2 0

On Linux, PPID refers to the process ID of the parent process. A parent process in Linux is the one that can spawn child processes. A single parent process can have multiple child processes, while 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’d like to show you the two methods of finding parent process IDs or PPIDs on Linux.

Display of PPIDs under Linux

To view the parent process IDs or PPIDs in Linux, you can choose one of the following two methods:

Method # 1: using the pstree command

To display the PPIDs using the pstree command, you need to run it as follows:

$ pstree -p

When this command is run, it will show all 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 figure:

Method # 2: Using the “ps” Command

To display the PPIDs via the “ps” command, you need to run it as follows:

$ ps -ef

ps -ef

When this command is run, it will show all 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 shown in the third column of the output. For example, the PPID of the splash process / sbin / init is 0, as shown in the following figure:

Use the ps command to view the parent process ID

Diploma:

We have shared with you the two different methods of viewing parent process IDs or PPIDs in Linux. If you followed both of these methods, you should just be running a single line command and you are good to go.

How to view PPIDs on Linux
Tags: