⚙️

systemd Cheat Sheet

Units, timers, journals, and service debugging on Linux.

Related: nginx · postgresql · redis · docker

Service control

CommandDescription
sudo systemctl start|stop|restart|reload <unit>Control a unit
sudo systemctl enable --now <unit>Enable and start on boot
sudo systemctl status <unit>State + recent log lines
sudo systemctl is-active <unit>Active check (exit code)

Units & timers

CommandDescription
systemctl list-units --type=service --state=runningRunning services
systemctl list-units --type=service --state=failedFailed services
systemctl list-timers --allScheduled timers
sudo systemctl daemon-reloadReload unit files after edit

Logs

CommandDescription
sudo journalctl -u <unit> -fFollow unit logs
sudo journalctl -u <unit> --since todayToday's logs
sudo journalctl -p err -bErrors this boot
sudo journalctl -xeRecent log with hints