Skip to content

systemctl

The systemctl utility is used to introspect and control the state of the systemd system and service manager.

It is used to view units and their status and enable or disable units.

Some systemctl commands (like those that change configuration) require root privileges.

The default command if none is specified is list-units.

Unit commands

Command Description
list‑units list-units [PATTERN...]

List units that systemd currently has in memory.
By default only units which are active, have pending jobs, or have failed are shown.

--all additionally shows units which are loaded but not active
--type, --scope, --state can be used to filter the units shown
list‑sockets list-sockets [PATTERN...]

List socket units currently in memory, ordered by listening address. If one or more PATTERNs are specified, only socket units matching one of them are shown.
list‑timers 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.
start start PATTERN...

Start (activate) one or more units specified on the command line.
stop stop PATTERN...

Stop (deactivate) one or more units specified on the command line.
reload reload PATTERN...

Asks all units listed on the command line to reload their configuration. Note that this will reload the service-specific configuration, not the unit configuration file of systemd.

If you want systemd to reload the configuration file of a unit, use the daemon-reload command.
restart restart PATTERN...

Stop and then start one or more units specified on the command line. If the units are not running yet, they will be started.
try‑restart try-restart PATTERN...

Stop and then start one or more units specified on the command line if the units are running. This does nothing if units are not running.
reload‑or‑restart reload-or-restart PATTERN...

Reload one or more units if they support it. If not, stop and then start them instead. If the units are not running yet, they will be started.
try‑reload‑or‑restart try-reload-or-restart PATTERN...

Reload one or more units if they support it. If not, stop and then start them instead. This does nothing if the units are not running.
isolate isolate UNIT

Start the unit specified on the command line and its dependencies and stop all others, unless they have IgnoreOnIsolate=yes.

If a unit name with no extension is given, an extension of ".target" will be assumed.
kill kill PATTERN...

Send a signal to one or more processes of the unit. Use --kill-who= to select which process to kill. Use --signal= to select the signal to send.
freeze freeze PATTERN...

Freeze one or more units specified on the command line using cgroup freezer.

Freezing the unit will cause all processes contained within the cgroup corresponding to the unit to be suspended. Being suspended means that unit's processes won't be scheduled to run on CPU until thawed.

freeze is only supported on systems that use unified cgroup hierarchy.
thaw thaw PATTERN...

Thaw (unfreeze) one or more units specified on the command line.

This is the inverse operation to the freeze command and resumes the execution of processes in the unit's cgroup.
is‑active 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.
is‑failed 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.
status 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.

Show terse runtime status information about one or more units including: name, description, unit file path, enabled/disabled state, vendor preset, and running state.

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.
show 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.

By default, empty properties are suppressed. Use--all to show those too. To select specific properties to show, use --property=.

This command is intended to be used whenever computer-parsable output is required. Use status if you are looking for formatted human-readable output.
cat cat PATTERN...

Show backing files of one or more units. Prints the "fragment" and "drop-ins" (source files) of units. Each file is preceded by a comment which includes the file name. Note that this shows the contents of the backing files on disk, which may not match the system manager's understanding of these units if any unit files were updated on disk and the daemon-reload command wasn't issued since.
set‑property set-property UNIT PROPERTY=VALUE...

Set the specified unit properties at runtime where this is supported. This allows changing configuration parameter properties such as resource control settings at runtime. Not all properties may be changed at runtime, but many resource control settings. The changes are applied immediately, and stored on disk for future boots, unless --runtime is passed, in which case the settings only apply until the next reboot. The syntax of the property assignment follows closely the syntax of assignments in unit files.

Example: systemctl set-property foobar.service CPUShares=777
help help PATTERN...\|PID...

Show manual pages for one or more units, if available. If a PID is given, the manual pages for the unit the process belongs to are shown.
restart‑failed reset-failed [PATTERN...]

Reset the "failed" state of the specified units, or if no unit name is passed, reset the state of all units. When a unit fails in some way (i.e. process exiting with non-zero error code, terminating abnormally or timing out), it will automatically enter the "failed" state and its exit code and status is recorded for introspection by the administrator until the service is stopped/re-started or reset with this command.
list‑dependencies list-dependencies [UNIT]

Shows units required and wanted by the specified unit. This recursively lists units following the Requires=, Requisite=, ConsistsOf=, Wants=, BindsTo= dependencies. If no unit is specified, default.target is implied.

By default, only target units are recursively expanded. When --all is passed, all other units are recursively expanded as well.

Options --reverse, --after, --before may be used to change what types of dependencies are shown.

Unit file commands

Command Description
list‑unit‑files list-unit-files [PATTERN...]

List unit files installed on the system, in combination with their enablement state (as reported by is-enabled)
enable enable UNIT..., enable PATH...

Enable one or more units or unit instances.

Note that this does not have the effect of also starting any of the units being enabled. If this is desired, combine this command with the --now switch, or invoke start with appropriate arguments later.

This command will print the file system operations executed. This output may be suppressed by passing --quiet.

Depending on whether --system, --user, --runtime, or --global is specified, this enables the unit for the system, for the calling user only, for only this boot of the system, or for all future logins of all users.
disable disable UNIT...

Disables one or more units.

This command expects valid unit names only, it does not accept paths to unit files.

Note that this command does not implicitly stop the units that are being disabled. If this is desired, either combine this command with the --now switch, or invoke the stop command with appropriate arguments later.

This command will print information about the file system operations executed. This output may be suppressed by passing --quiet.

This command honors --system, --user, --runtime and --global in a similar way as enable.
reenable reenable UNIT...

Reenable one or more units, as specified on the command line. This is a combination of disable and enable and is useful to reset the symlinks a unit file is enabled with to the defaults configured in its "[Install]" section. This command expects a unit name only, it does not accept paths to unit files.
preset preset UNIT...

Reset the enable/disable status one or more unit files, as specified on the command line, to the defaults configured in the preset policy files. This has the same effect as disable or enable, depending how the unit is listed in the preset files.

Use --preset-mode= to control whether units shall be enabled and disabled, or only enabled, or only disabled.
preset‑all preset-all

Resets all installed unit files to the defaults configured in the preset policy file.

Use --preset-mode= to control whether units shall be enabled and disabled, or only enabled, or only disabled.
is‑enabled is-enabled UNIT...

Checks whether any of the specified unit files are enabled (as with enable). Returns an exit code 0 if at least one is enabled, non-zero otherwise. Prints the current enable status. To suppress this output, use --quiet. To show installation targets, use --full.
mask mask UNIT...

Mask one or more units, as specified on the command line. This will link these unit files to /dev/null, making it impossible to start them. This is a stronger version of disable, since it prohibits all kinds of activation of the unit, including enablement and manual activation.
umask unmask UNIT...

Unmask one or more unit files, as specified on the command line. This will undo the effect of mask. This command expects valid unit names only, it does not accept unit file paths.
link link PATH...

Link a unit file that is not in the unit file search paths into the unit file search path. This command expects an absolute path to a unit file. The effect of this may be undone with disable.

The effect of this command is that a unit file is made available for commands such as start, even though it is not installed directly in the unit search path.

The file system where the linked unit files are located must be accessible when systemd is started (e.g. anything underneath /home or /var is not allowed, unless those directories are located on the root file system).
revert revert UNIT...

Revert one or more unit files to their vendor versions. This command removes drop-in configuration files that modify the specified units, as well as any user-configured unit file that overrides a matching vendor supplied unit file.

Effectively, this command may be used to undo all changes made with systemctl edit, systemctl set-property and systemctl mask and puts the original unit file with its settings back in effect.
add‑wants add-wants TARGET UNIT..., add-requires TARGET UNIT...

Adds "Wants=" or "Requires=" dependencies, respectively, to the specified TARGET for one or more units.

This command honors --system, --user, --runtime and --global in a way similar to enable.
edit edit UNIT...

Edit a drop-in snippet or a whole replacement file if --full is specified, to extend or override the specified unit.

Depending on whether --system (the default), --user, or --global is specified, this command creates a drop-in file for each unit either for the system, for the calling user, or for all futures logins of all users. Then, the editor is invoked on temporary files which will be written to the real location if the editor exits successfully.

If --full is specified, this will copy the original units instead of creating drop-in files. If --force is specified and any units do not already exist, new unit files will be opened for editing. If --runtime is specified, the changes will be made temporarily in /run and they will be lost on the next reboot.

If the temporary file is empty upon exit, the modification of the related unit is canceled.

After the units have been edited, systemd configuration is reloaded (in a way that is equivalent to daemon-reload).
get‑default get-default

Return the default target to boot into. This returns the target unit name default.target is aliased (symlinked) to.
set‑default set-default TARGET

Set the default target to boot into. This sets (symlinks) the default.target alias to the given target unit.

Machine commands

Command Description
list‑machines list-machines [PATTERN...]

List the host and all running local containers with their state. If one or more PATTERNs are specified, only containers matching one of them are shown.

Job commands

Command Description
list‑jobs list-jobs [PATTERN...]

List jobs that are in progress. If one or more PATTERNs are specified, only jobs for units matching one of them are shown.

When combined with --after or --before the list is augmented with information on which other job each job is waiting for, and which other jobs are waiting for it, see above.
cancel cancel JOB...

Cancel one or more jobs specified on the command line by their numeric job IDs. If no job ID is specified, cancel all pending jobs.

Environment commands

Command Description
show‑environment show-environment

Dump the systemd manager environment block. This is the environment block that is passed to all processes the manager spawns. The environment block will be dumped in straight-forward form suitable for sourcing into most shells.
set‑environment set-environment VARIABLE=VALUE...

Set one or more systemd manager environment variables, as specified on the command line.
unset‑environment unset-environment VARIABLE...

Unset one or more systemd manager environment variables. If only a variable name is specified, it will be removed regardless of its value. If a variable and a value are specified, the variable is only removed if it has the specified value.
import‑environment import-environment [VARIABLE...]

Import all, one or more environment variables set on the client into the systemd manager environment block. If no arguments are passed, the entire environment block is imported. Otherwise, a list of one or more environment variable names should be passed, whose client-side values are then imported into the manager's environment block.

Manager lifecycle commands

Command Description
daemon‑reload Reload the systemd manager configuration. This will rerun all generators, reload all unit files, and recreate the entire dependency tree. While the daemon is being reloaded, all sockets systemd listens on behalf of user configuration will stay accessible.

This command should not be confused with the reload command.
daemon‑exec daemon-reexec

Reexecute the systemd manager. This will serialize the manager state, reexecute the process and deserialize the state again. This command is of little use except for debugging and package upgrades. Sometimes, it might be helpful as a heavy-weight daemon-reload. While the daemon is being reexecuted, all sockets systemd listening on behalf of user configuration will stay accessible.

System commands

Command Description
is‑system‑running is-system-running

Checks whether the system is operational. This returns success (exit code 0) when the system is fully up and running, specifically not in startup, shutdown or maintenance mode, and with no failed services. Failure is returned otherwise (exit code non-zero).

In addition, the current state is printed in a short string to standard output, see the table below. Use --quiet to suppress this output.
default default

Enter default mode. This is equivalent to systemctl isolate default.target. This operation is blocking by default, use --no-block to request asynchronous behavior.
rescue rescue

Enter rescue mode. This is equivalent to systemctl isolate rescue.target. This operation is blocking by default, use--no-block to request asynchronous behavior.
emergency emergency

Enter emergency mode. This is equivalent to systemctl isolate emergency.target. This operation is blocking by default, use --no-block to request asynchronous behavior.
halt halt

Shut down and halt the system. This is mostly equivalent to systemctl start halt.target --job-mode=replace-irreversibly --no-block, but also prints a wall message to all users. This command is asynchronous; it will return after the halt operation is enqueued, without waiting for it to complete.

Note that this operation will simply halt the OS kernel after shutting down, leaving the hardware powered on. Use systemctl poweroff for powering off the system.
poweroff poweroff

Shut down and power-off the system. This is mostly equivalent to systemctl start poweroff.target --job-mode=replace-irreversibly --no-block, but also prints a wall message to all users. This command is asynchronous; it will return after the power-off operation is enqueued, without waiting for it to complete.

If combined with --force, shutdown of all running services is skipped, however all processes are killed and all file systems are unmounted or mounted read-only, immediately followed by the powering off.

If --force is specified twice, the operation is immediately executed without terminating any processes or unmounting any file systems. This may result in data loss. Note that when --force is specified twice the power-off operation is executed by systemctl itself, and the system manager is not contacted. This means the command should succeed even when the system manager has crashed.
reboot reboot [arg]

Shut down and reboot the system. This is mostly equivalent to systemctl start reboot.target --job-mode=replace-irreversibly --no-block, but also prints a wall message to all users. This command is asynchronous; it will return after the reboot operation is enqueued, without waiting for it to complete.

--force works the same as the poweroff command.

If the optional argument arg is given, it will be passed as the optional argument to the reboot(2) system call. The value is architecture and firmware specific. As an example, "recovery" might be used to trigger system recovery, and "fota" might be used to trigger a “firmware over the air” update.
kexec kexec

Shut down and reboot the system via kexec. This is equivalent to systemctl start kexec.target --job-mode=replace-irreversibly --no-block. This command is asynchronous; it will return after the reboot operation is enqueued, without waiting for it to complete.

If combined with --force, shutdown of all running services is skipped, however all processes are killed and all file systems are unmounted or mounted read-only, immediately followed by the reboot.
exit exit [EXIT_CODE]

Ask the service manager to quit. This is only supported for user service managers (i.e. in conjunction with the --user option) or in containers and is equivalent to poweroff otherwise. This command is asynchronous; it will return after the exit operation is enqueued, without waiting for it to complete.

The service manager will exit with the specified exit code, if EXIT_CODE is passed.
switch‑root switch-root ROOT [INIT]

Switches to a different root directory and executes a new system manager process below it. Thisis intended for usage in initial RAM disks ("initrd"), and will transition from the initrd's system manager process (a.k.a. "init" process) to the main system manager process which is loaded from the actual host volume.
suspend suspend

Suspend the system. This will trigger activation of the special target unit suspend.target. This command is asynchronous, and will return after the suspend operation is successfully enqueued. It will not wait for the suspend/resume cycle to complete.
hibernate hibernate

Hibernate the system. This will trigger activation of the special target unit hibernate.target. This command is asynchronous, and will return after the hibernation operation is successfully enqueued. It will not wait for the hibernate/thaw cycle to complete.
hybrid‑sleep hybrid-sleep

Hibernate and suspend the system. This will trigger activation of the special target unit hybrid-sleep.target. This command is asynchronous, and will return after the hybrid sleep operation is successfully enqueued. It will not wait for the sleep/wake-up cycle to complete.