The systemctl
command may be used to introspect and control the state of the "systemd" system and service manager. Please refer to systemd(1) for an introduction into the basic concepts and functionality this tool manages.
Command | Task |
---|---|
systemctl status UNIT |
View detailed information about a unit's state. |
systemctl stop UNIT |
Stop a service on a running system. |
systemctl start UNIT |
Start a service on a running system. |
systemctl restart UNIT |
Restart a service on a running system. |
systemctl reload UNIT |
Reload the configuration file of a running service. |
systemctl mask UNIT |
Disable a service from being started, both manually and at boot. |
systemctl unmask UNIT |
Make available a masked service. |
systemctl enable UNIT |
Configure a service to start at boot time. Use the --now option to also start the service. |
systemctl disable UNIT |
Disable a service from starting at boot time. Use the --now option to also stop the service. |
Command | Use |
---|---|
systemctl start sshd |
Starts the sshd daemon (ssh server) |
systemctl stop sshd |
Stops the sshd daemon. If still enabled, this will mean that it will restart when a reboot occurs |
systemctl enable sshd |
This will set the sshd daemon to start on boot, but does not start it immediately |
systemctl enable --now sshd |
Enables the sshd service to start automatically on boot and immediately starts it. This command combines two actions:
|
systemctl status |
Displays the overall system status, including information about active and inactive units (services, sockets, targets, etc.). This command provides a summary of the current state of the system's services and their associated processes. |
systemctl list-units --type=service |
Lists all the units of type 'service' |
systemctl list-unit-files --state=enabled |
Lists all enabled unit files in the system, including services, sockets, and targets. This command provides a comprehensive overview of the units that are set to start automatically during system boot. |
systemctl set-default multi-user.target |
Sets the default boot to CLI |
systemctl isolate multi-user.target |
Switches immediately to CLI mode only |
systemctl is-enabled chronyd |
Checks if a unit is enabled and returns the appropriate response |
systemctl is-active chronyd |
Checks if unit is active and returns its current status |
/var/log/journal
journalctl --disk-usage
SystemMaxUse
setting in /etc/systemd/jourald.conf
e.g. SystemMaxUse=100M
to set to 100 megabytesRequires the journald service to be restarted
systemctl restart systemd-journald.service
to restart