LinuxCommandLibrary

systemctl-whoami

Show unit owning a process

TLDR

Show current shell's unit

$ systemctl whoami
copy
Show for user service manager
$ systemctl whoami --user
copy
Show unit for specific PID
$ systemctl whoami [pid]
copy
Show units for multiple PIDs
$ systemctl whoami [pid1 pid2 ...]
copy

SYNOPSIS

systemctl whoami [PID...]

DESCRIPTION

systemctl whoami displays which systemd unit a process belongs to. Without arguments, it shows the unit of the current shell (the process running systemctl).
With PIDs specified, it shows the units for those processes. This helps identify which service or scope owns a particular process.

PARAMETERS

--user

Query user service manager
--system
Query system service manager (default)

CAVEATS

Processes not managed by systemd may show as belonging to the root slice or have no associated unit. Container processes may appear differently.

HISTORY

The whoami subcommand provides a quick way to identify which unit a process is running under, useful for debugging and understanding cgroup membership.

SEE ALSO

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community