Skip to main content
Kill -9 Club
Sign in

systemctl

systemdPackage: systemd

Drives systemd units: start, stop, enable at boot, read the state. status says what is happening now, is-enabled what will happen at the next boot; those are two different questions.

What its options do in the lessons

From the same glossary the lessons render under their commands, so the two cannot disagree.

systemctl --now
With enable or disable, also acts now: enable --now enables at boot *and* starts the service immediately.
systemctl --failed
Lists only the units in a failed state.
systemctl --no-pager
Opens no interactive pager for long output such as systemctl status. In a script with no terminal, without it the pager waits for a keypress and the run hangs.
systemctl --all
Includes inactive units, which the default listing leaves out.
systemctl --type
Restricts to one unit type (--type=service).
systemctl --state
Restricts to one state (--state=failed).
systemctl --quiet
Prints nothing and answers through the exit code alone. That is what makes is-active --quiet usable in an if.
systemctl --plain
Prints a plain list rather than a tree.
systemctl --no-legend
Drops the header and summary, so the output can be read by a script.
systemctl -P
Like -p, but prints the value alone, without the leading Name=. The form for scripts, where you want the value and nothing else.
systemctl -n
How many journal lines systemctl status shows at the bottom of its output.
systemctl --after
With list-dependencies: the units this one waits for — what must start *before* it. Ordering, not dependency.
systemctl --before
The reverse of --after: the units that wait for this one.
systemctl --reverse
With list-dependencies: what depends on this unit, rather than what it depends on. The question to ask before stopping something.
systemctl --drop-in
With edit: names the drop-in file instead of the default override.conf. Useful for keeping two independent tweaks apart under <unit>.d/.
systemctl --full
With edit: copies the whole unit into /etc instead of a drop-in. You stop receiving the package’s fixes from then on — almost always the wrong choice.
systemctl --runtime
The change does not survive a reboot: it is written under /run. For trying a setting before committing to it.
systemctl --version
The installed systemd version — which matters because some directives only exist from a given version.
systemctl -p
Shows only the named property of the unit (-p MainPID).

Lessons that teach it