Skip to content
# Process & service management

systemd & systemctl

Start, stop, enable and inspect services with systemd's systemctl command.

What systemd does

systemd is the init system on almost every current distro (Ubuntu, Debian, RHEL/Fedora, Arch, openSUSE). It starts services at boot, restarts them if they crash, and tracks their state as "units" β€” most commonly .service files. Alpine is the exception: it uses OpenRC, with rc-service/rc-update instead of systemctl.

Start, stop and restart a service

These act immediately on the running service without changing whether it starts at boot.

bash
sudo systemctl start nginx
sudo systemctl stop nginx
sudo systemctl restart nginx
sudo systemctl reload nginx   # re-read config without dropping connections, if supported

Enable a service at boot

enable only changes whether the service starts on the next boot; it does not start it now. --now does both in one step.

bash
sudo systemctl enable nginx
sudo systemctl enable --now nginx   # enable and start immediately
sudo systemctl disable nginx

Check status and logs

status gives a quick health snapshot including the last few log lines; journalctl -u gives the full log for that unit.

bash
systemctl status nginx
journalctl -u nginx -n 50          # last 50 lines
journalctl -u nginx -f             # follow live

List units

Useful for seeing everything running, or everything that failed.

bash
systemctl list-units --type=service --state=running
systemctl --failed