Systemctl
lastmod 2023-02-26created 2015-01-1517 edits
Query or send control commands to the system manager.
Categories
Unit Commands
-
list-units [PATTERN...]: List units currently in memory -
list-sockets [PATTERN...]: List socket units currently in memory, ordered by address -
list-timers [PATTERN...]: List timer units currently in memory, ordered by next elapse -
start UNIT...: Start (activate) one or more units -
stop UNIT...: Stop (deactivate) one or more units -
reload UNIT...: Reload one or more units -
restart UNIT...: Start or restart one or more units -
try-restart UNIT...: Restart one or more units if active -
reload-or-restart UNIT...: Reload one or more units if possible, otherwise start or restart -
try-reload-or-restart UNIT...: If active, reload one or more units, if supported, otherwise restart -
isolate UNIT: Start one unit and stop all others -
kill UNIT...: Send signal to processes of a unit -
clean UNIT...: Clean runtime, cache, state, logs or configuration of unit -
freeze PATTERN...: Freeze execution of unit processes -
thaw PATTERN...: Resume execution of a frozen unit -
is-active PATTERN...: Check whether units are active -
is-failed PATTERN...: Check whether units are failed -
status [PATTERN...|PID...]: Show runtime status of one or more units -
show [PATTERN...|JOB...]: Show properties of one or more units/jobs or the manager -
cat PATTERN...: Show files and drop-ins of specified units -
set-property UNIT PROPERTY=VALUE...: Sets one or more properties of a unit -
help PATTERN...|PID...: Show manual for one or more units -
reset-failed [PATTERN...]: Reset failed state for all, one, or more units -
list-dependencies [UNIT...]: Recursively show units which are required or wanted by the units or by which those units are required or wanted
Unit File Commands
-
list-unit-files [PATTERN...]: List installed unit files -
enable [UNIT...|PATH...]: Enable one or more unit files -
disable UNIT...: Disable one or more unit files -
reenable UNIT...: Reenable one or more unit files -
preset UNIT...: Enable/disable one or more unit files based on preset configuration -
preset-all: Enable/disable all unit files based on preset configuration -
is-enabled UNIT...: Check whether unit files are enabled -
mask UNIT...: Mask one or more units -
unmask UNIT...: Unmask one or more units -
link PATH...: Link one or more units files into the search path -
revert UNIT...: Revert one or more unit files to vendor version -
add-wants TARGET UNIT...: Add 'Wants' dependency for the target on specified one or more units -
add-requires TARGET UNIT...: Add 'Requires' dependency for the target on specified one or more units -
edit UNIT...: Edit one or more unit files -
get-default: Get the name of the default target -
set-default TARGET: Set the default target
Machine Commands
-
list-machines [PATTERN...]: List local containers and host
Job Commands
-
list-jobs [PATTERN...]: List jobs -
cancel [JOB...]: Cancel all, one, or more jobs
Environment Commands
-
show-environment: Dump environment -
set-environment VARIABLE=VALUE...: Set one or more environment variables -
unset-environment VARIABLE...: Unset one or more environment variables -
import-environment [VARIABLE...]: Import all or some environment variables
Manager State Commands
-
daemon-reload: Reload systemd manager configuration -
daemon-reexec: Reexecute systemd manager -
log-level [LEVEL]: Get/set logging threshold for manager -
log-target [TARGET]: Get/set logging target for manager -
service-watchdogs [BOOL]: Get/set service watchdog state
System Commands
-
is-system-running: Check whether system is fully running -
default: Enter system default mode -
rescue: Enter system rescue mode -
emergency: Enter system emergency mode -
halt: Shut down and halt the system -
poweroff: Shut down and power-off the system -
reboot: Shut down and reboot the system -
kexec: Shut down and reboot the system with kexec -
exit [EXIT_CODE]: Request user instance or container exit -
switch-root ROOT [INIT]: Change to a different root file system -
suspend: Suspend the system -
hibernate: Hibernate the system -
hybrid-sleep: Hibernate and suspend the system -
suspend-then-hibernate: Suspend the system, wake after a period of time, and hibernate
Examples
-
systemctl list-unit-files - Print the list of unit files.
-
systemctl list-units - Print the list of units.
-
systemctl list-units --type=target - Print the list of active target units.
-
systemctl list-units --type=target --all - Print the list of all target units.
-
systemctl list-units --state=active - List of everything active
-
systemctl list-units --type=service --state=running - List of services whose state is running
-
systemctl stop [service] - Stop a service.
-
systemctl start [service] - Start a service.
-
systemctl restart [service] - Restart a service.
-
systemctl reload [service] - Reload a service.
-
systemctl status [service] - List status of service
-
systemctl enable [service] - Run automatically at boot
-
systemctl is-enabled [service] - Check whether it is enabled
-
systemctl isolate runlevel<NUM>.target - Change the current RUN LEVEL.
-
systemctl isolate graphical.target - Change the current RUN LEVEL to Graphical.
-
systemctl set-default graphical.target - Change the default RUN LEVEL to Graphical. (Applied automatically at boot)
See also
- sysz - A fzf terminal UI for systemctl
Favorite site
- Simple systemctl usage
- systemctl usage summary
- linux - systemd, systemctl
- Managing services to run at boot with systemd (CentOS 7)
- Summary of options for registering systemd units
- Managing services
- How to set up a new service in Linux systemctl
- Working with Systemd Unit files
- Understanding Systemd Units and Unit Files
- Managing run levels (targets) with linux systemd (systemctl)