LinuxCommandLibrary

systemctl-is-active

Check if units are running

TLDR

Check if unit is active

$ systemctl is-active [unit]
copy
Check multiple units
$ systemctl is-active [unit1 unit2 ...]
copy
Quiet mode (exit code only)
$ systemctl is-active [unit] -q
copy
Check user unit
$ systemctl is-active [unit] --user
copy

SYNOPSIS

systemctl is-active [OPTIONS] PATTERN...

DESCRIPTION

systemctl is-active checks whether one or more units are currently active (running). It prints the active state and returns exit code 0 if at least one unit is active.
Possible states include: active, inactive, activating, deactivating, failed. For multiple units, each state is printed on a separate line.

PARAMETERS

-q, --quiet

Suppress output, return only exit code
--user
Check user units
--system
Check system units (default)

EXIT STATUS

Returns 0 if at least one unit is active, non-zero otherwise. This makes it useful in shell scripts for conditional logic based on service state.

CAVEATS

Only checks current runtime state, not enablement. A unit can be enabled but not active, or active but not enabled. Use `is-enabled` to check the boot configuration.

HISTORY

The is-active subcommand provides a scriptable way to query service state, replacing parsing of `systemctl status` output.

SEE ALSO

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community