Skip to content

Maintenance Ruby 3.4 gets fixes, but no new features. Switch to Ruby 4.0 →

class method

Process.ppid

() -> ::Integer
Process.ppid → integer

Returns the process ID of the parent of the current process:

Example
puts "Pid is #{Process.pid}."
fork { puts "Parent pid is #{Process.ppid}." }

Output:

Pid is 271290.
Parent pid is 271290.

May not return a trustworthy value on certain platforms.

See also .pid .setpgid .maxgroups= .setpgrp also in 4.1 · 4.0 · 3.3 · 3.2 · 3.1 · 3.0