Services
systemctl status nginx # state, recent log linessudo systemctl start nginxsudo systemctl stop nginxsudo systemctl restart nginx # stop, then startsudo systemctl reload nginx # re-read config, without a restartsudo systemctl reload-or-restart nginxAt boot
sudo systemctl enable nginx # start at bootsudo systemctl enable --now nginx # and start it nowsudo systemctl disable nginxsudo systemctl disable --now nginx # and stop it nowsystemctl is-enabled nginxsudo systemctl mask nginx # forbid it from starting at allsudo systemctl unmask nginxenable doesn’t start anything until the next boot, and start doesn’t survive one. You usually want both, which is enable --now.
What’s running, and what failed
systemctl --failed # what failed?systemctl list-units --type=service # loaded servicessystemctl list-units --state=running --type=servicesystemctl list-unit-files --type=service # all, with enabled/disabledsystemctl is-active nginx # for scriptssudo systemctl reset-failed nginx # clear a "failed" statesystemctl status 812 # which unit does this PID belong to?Change a unit
systemctl cat nginx # the unit, and every overridesystemctl show nginx -p Restart,User,ExecStart # effective settingssudo systemctl edit nginx # add an override (survives upgrades)sudo systemctl edit --full nginx # edit a full copysudo systemctl revert nginx # remove your overridessudo systemctl daemon-reload # after changing a unit file by handUnit files you write go in /etc/systemd/system/. The systemd Unit Generator writes them for you.
Machine state
systemctl is-system-running # running, or degraded?systemctl get-default # multi-user or graphical?sudo systemctl rebootsudo systemctl poweroffsystemd-analyze blame # what made boot slow?systemd-analyze verify myapp.service # check a unit for mistakesTimers
systemctl list-timers --all # when did each run, and when's next?sudo systemctl enable --now backup.timersudo systemctl start backup.service # run the job nowjournalctl -u backup.service -n 50systemd-analyze calendar 'Mon *-*-* 03:00' # check a scheduleRead logs
journalctl -u nginx # one servicejournalctl -u nginx -f # followjournalctl -u nginx -n 50 --no-pager # last 50 lines, for pastingjournalctl -xeu nginx # the end, with explanationsjournalctl -b # since this bootjournalctl -b -1 # the previous bootjournalctl -k # kernel messages onlyFilter logs
journalctl --since "1 hour ago"journalctl --since "2026-11-06 09:00" --until "2026-11-06 10:00"journalctl --since today -u nginx -u php8.3-fpm # several unitsjournalctl -p err -b # errors and worse, this bootjournalctl -g 'timed out' -u nginx # search by text (a regex)journalctl _PID=812 # one processjournalctl -o json-pretty -n 1 # every field of one entryjournalctl -o cat -u nginx # only the messagesPriorities, from worst: emerg, alert, crit, err, warning, notice, info, debug.
Log disk space
journalctl --disk-usagesudo journalctl --vacuum-size=500M # shrink to 500 MBsudo journalctl --vacuum-time=14d # keep two weeksTo set a lasting limit, use SystemMaxUse=500M in /etc/systemd/journald.conf, then sudo systemctl restart systemd-journald.
Your own user’s services
systemctl --user status myappsystemctl --user enable --now myappjournalctl --user -u myappsudo loginctl enable-linger alex # keep them running after logging outCommon errors
Job for … failed because the control process exitedAddress already in use- A cron job that doesn’t run
- Linux process
Killed
Practice these
A guided lesson, in your browser: Services: systemctl and journalctl.