Systemd, Systemctl & Journalctl Commands Cheat Sheet
Production Systemd cheat sheet: systemctl start, stop, reload, boot enable --now, service masking, journalctl -u -f log tailing, and drop-in unit overrides with 1-click copy.
Service Lifecycle (6 commands)
sudo systemctl start <service_name>
Starts a stopped systemd service unit immediately in the background.
sudo systemctl stop <service_name>
Gracefully terminates a running service, sending SIGTERM before SIGKILL.
sudo systemctl restart <service_name>
Stops and re-starts the service, reloading newly compiled binaries and state.
sudo systemctl reload <service_name>
Instructs the service to re-read its configuration files without dropping connections.
systemctl status <service_name>
Displays active state, PID, memory usage, CPU time, and recent log snippet.
systemctl is-active <service_name>
Returns active or inactive. Returns shell exit code 0 if service is running.
Startup & Enablement (5 commands)
sudo systemctl enable <service_name>
Creates a symlink in /etc/systemd/system/multi-user.target.wants/ to launch on boot.
sudo systemctl enable --now <service_name>
Enables the service to launch on system boot AND starts it immediately.
sudo systemctl disable <service_name>
Removes the boot startup symlink so the service will not launch on restart.
sudo systemctl mask <service_name>
Links the service unit file to /dev/null, rendering it completely un-startable.
sudo systemctl unmask <service_name>
Restores a masked service, allowing it to be started or enabled normally.
Unit Files & Reload (3 commands)
sudo systemctl daemon-reload
Reloads systemd manager configuration after editing any .service file in /etc.
systemctl list-units --type=service --state=running
Lists all currently running background services across the entire system.
sudo systemctl edit <service_name>
Creates a drop-in override file (override.conf) to modify parameters safely.
Journalctl Logs (5 commands)
journalctl -u <service_name> -f
Tails live logs for a specific service in real-time (similar to tail -f).
journalctl -u <service_name> -n 100 --no-pager
Displays the most recent 100 log lines from the service without opening less.
journalctl -u <service_name> --since "1 hour ago"
Filters log entries generated within the last hour for targeted incident triage.
journalctl -p err -b
Shows all error, critical, and emergency priority logs since the current boot.
sudo journalctl --vacuum-size=500M
Prunes archived journal logs so total log disk consumption remains under 500MB.