1

I need to know if a process has any children process, so I use the command

pgrep -P <ProcessID>

Then I get all the children processes. But when I use the command with an empty value and double quotation marks like that:

pgrep -P ""

As a response I get the numbers: 1,2 What is the meaning of that result?

Yaron
  • 4,289

1 Answers1

1

Running pgrep -P "" is equivalent of running pgrep -P 0

Process ID 0 has two children with PID of 1 and 2:

UID        PID  PPID  C STIME TTY          TIME CMD
root         1     0  0 Jun24 ?        00:00:02 /sbin/init
root         2     0  0 Jun24 ?        00:00:00 [kthreadd]

More info in this answer

Yaron
  • 4,289