sudo systemctl show myapp -p MainPID

Category: VPS Management

sudo systemctl show myapp -p MainPID

Show the service's main process ID

systemctl show exposes machine-readable unit properties; -p MainPID filters to just the process ID of the service's main process. That PID is what you target with ps, strace, or kill when investigating a specific worker. A value of 0 means the service is not currently running.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.