Inspecting and controlling systemd state
systemctl
is used to control the systemd system and service manager.
Together with journald, this is typically your main point of interaction with a running systemd instance.
For a complete description, see systemctl(1).
Common systemctl commands
systemctl start PATTERN…
systemctl stop PATTERN…
systemctl reload PATTERN…
systemctl restart PATTERN…
Start, stop, reload 1 or restart one or more units specified on the command line.
This command should not be confused with the daemon-reload command.
systemctl list-units [PATTERN…]
List units that systemd currently has in memory. This includes units that are either referenced directly or through a dependency, units that are pinned by applications programmatically, or units that were active in the past and have failed.
By default only units which are active, have pending jobs, or have failed are shown; this can be changed with option
--all
. If one or morePATTERN
s are specified, only units matching one of them are shown. The units that are shown are additionally filtered by--type=
and--state=
if those options are specified.
systemctl list-timers [PATTERN…]
List timer units currently in memory, ordered by the time they elapse next. If one or more PATTERNs are specified, only units matching one of them are shown.
systemctl status [PATTERN…|PID]
Show terse runtime status information about one or more units, followed by most recent log data from the journal. If no units are specified, show system status. If combined with
--all
, also show the status of all units (subject to limitations specified with-t
). If a PID is passed, show information about the unit the process belongs to.This function is intended to generate human-readable output. If you are looking for computer-parsable output, use show instead. By default, this function only shows 10 lines of output and ellipsizes lines to fit in the terminal window. This can be changed with
--lines
and--full
, see above. In addition,journalctl --unit=NAME
orjournalctl --user-unit=NAME
use a similar filter for messages and might be more convenient.
systemctl show [PATTERN…|JOB…]
Show properties of one or more units, jobs, or the manager itself. If no argument is specified, properties of the manager will be shown. If a unit name is specified, properties of the unit are shown, and if a job ID is specified, properties of the job are shown.
systemctl cat PATTERN…
Show backing files of one or more units. Prints the “fragment” and “drop-ins” (source files) of units.
systemctl is-active PATTERN…
Check whether any of the specified units are active (i.e. running). Returns an exit code
0
if at least one is active, or non-zero otherwise. Unless--quiet
is specified, this will also print the current unit state to standard output.
systemctl is-failed PATTERN…
Check whether any of the specified units are in a “failed” state. Returns an exit code
0
if at least one has failed, non-zero otherwise. Unless--quiet
is specified, this will also print the current unit state to standard output.
-
Not all units have a reload command defined, so this may not always be available. By convention a reload is a graceful action with minimal to no impact on running services or active clients. ↩︎