Skip to content

End of Life Ruby 3.0 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →

class method

Process.ppid

Process.ppid → integer

Returns the process id of the parent of this process. Returns untrustworthy value on Win32/64. Not available on all platforms.

Example
puts "I am #{Process.pid}"
Process.fork { puts "Dad is #{Process.ppid}" }

produces:

Example
I am 27417
Dad is 27417
See also .pid .setpgid .maxgroups= .setpgrp also in 4.1 · 4.0 · 3.4 · 3.3 · 3.2 · 3.1