~/cheat-sheets / systemctl
systemctl cheat sheet
Field-tested systemd commands for everyday admin work – searchable and copyable in one click. Units, timers, overrides and boot analysis.
Download as PDF (A4, free to share) ↓
37 commands
Status & control
State and latest log lines of a unit
systemctl status nginxStart a unit
sudo systemctl start nginxStop a unit
sudo systemctl stop nginxStop and start a unit again
⚠ Careful: changes or deletes datasudo systemctl restart nginxReload the config without stopping
sudo systemctl reload nginxShort state: active, inactive or failed
systemctl is-active nginxCheck whether the unit starts at boot
systemctl is-enabled nginx
Autostart & masking
Enable autostart at boot
sudo systemctl enable nginxEnable autostart and start now
sudo systemctl enable --now nginxDisable autostart
sudo systemctl disable nginxFully block a unit (also as dependency)
⚠ Careful: changes or deletes datasudo systemctl mask nginxRemove the mask
sudo systemctl unmask nginxRe-read unit files after changes
sudo systemctl daemon-reload
Finding & inspecting units
List all failed units
systemctl --failedList running services
systemctl list-units --type=service --state=runningShow the unit file including drop-ins
systemctl cat nginxDependency tree of a unit
systemctl list-dependencies nginx
Journal pointers
Follow the logs of a unit live
journalctl -u nginx -fMessages from the last hour
journalctl -u nginx --since '1 hour ago'Errors since the last boot
journalctl -b -p errDisk space used by the journal
journalctl --disk-usage
Timers
All timers with next and last run
systemctl list-timers --allEnable and start a timer
sudo systemctl enable --now backup.timerRun the matching job once right now
sudo systemctl start backup.serviceTimer line: every day at 03:00
OnCalendar=*-*-* 03:00:00Timer line: catch up on missed runs after boot
Persistent=trueValidate a time expression and show next run
systemd-analyze calendar 'Mon *-*-* 06:00'
Overrides with drop-ins
Create a drop-in (survives package updates)
sudo systemctl edit nginxDiscard all local changes to the unit
⚠ Careful: changes or deletes datasudo systemctl revert nginxDrop-in [Service]: restart on failure (RestartSec=5 waits 5 s)
Restart=on-failureDrop-in [Service]: cap memory at 1 GB
MemoryMax=1GDrop-in [Service]: clear the inherited ExecStart before setting a new one
ExecStart=
Analysis & targets
Show total boot time
systemd-analyzeThe 15 slowest units at boot
systemd-analyze blame | head -n 15Sandboxing score of a unit
systemd-analyze security nginxBoot without a graphical interface
sudo systemctl set-default multi-user.targetSwitch to rescue mode (stops services)
⚠ Careful: changes or deletes datasudo systemctl isolate rescue.target
No match.
New articles by e-mail
One e-mail per new article. No tracking, unsubscribe any time. As a thank-you after confirming: my “Server operations & patching” checklist (PDF).