systemctl Commands

systemctl commands cheatsheet.

Start, stop, enable and inspect systemd services — plus the journalctl commands to read their logs. Tap to copy.

Service control
sudo systemctl start nginxStart a service now
sudo systemctl stop nginxStop a running service
sudo systemctl restart nginxRestart (stop then start) a service
sudo systemctl reload nginxReload config without a full restart
sudo systemctl enable nginxStart the service automatically at boot
sudo systemctl disable nginxDon't start the service at boot
sudo systemctl enable --now nginxEnable at boot and start immediately
Status & inspection
systemctl status nginxShow whether a service is running, with recent logs
systemctl is-active nginxPrint active or inactive for a service
systemctl is-enabled nginxCheck whether a service starts at boot
systemctl list-units --type=serviceList loaded services and their state
systemctl --failedList units that failed to start
systemctl list-unit-files --state=enabledList everything enabled at boot
Logs (journalctl)
journalctl -u nginxShow logs for one service
journalctl -u nginx -fFollow a service's logs live
journalctl -u nginx --since "1 hour ago"Logs for a service within a time window
journalctl -bLogs since the last boot
journalctl -p errOnly error-priority messages and worse
System state
sudo systemctl daemon-reloadReload unit files after editing them
sudo systemctl rebootReboot the machine
sudo systemctl poweroffShut the machine down
systemctl get-defaultShow the default boot target
sudo systemctl set-default multi-user.targetBoot to console instead of the GUI

Managing services with systemd

systemd is the init system on most modern Linux distributions, and systemctl is how you control it — starting, stopping, enabling and checking services. The distinction worth remembering: start affects a service right now, while enable controls whether it comes back after a reboot. For the logs behind a service, pair it with journalctl.

See also the general Linux commands cheatsheet, crontab for scheduled jobs, and SSH for managing remote machines.

FAQ

What's the difference between enable and start?
start runs a service immediately but doesn't survive a reboot; enable makes it launch at boot. Use enable --now to do both at once.
How do I see why a service failed?
Run systemctl status name for a summary, then journalctl -u name for the full logs. Add -f to follow them live.

More cheatsheets