systemctl — Service Management Cheatsheet

Control systemd services on Ubuntu / Debian Linux.


Start / Stop / Restart

sudo systemctl start <service>      # start now
sudo systemctl stop <service>       # stop now
sudo systemctl restart <service>    # stop + start
sudo systemctl reload <service>     # reload config without full restart (if supported)

Enable / Disable (boot behaviour)

sudo systemctl enable <service>           # auto-start on boot
sudo systemctl disable <service>          # don't auto-start on boot (keeps running now)
sudo systemctl enable --now <service>     # enable + start immediately
sudo systemctl disable --now <service>    # disable + stop immediately

Mask / Unmask (hard block)

sudo systemctl mask <service>     # completely prevent starting (even manually or as dependency)
sudo systemctl unmask <service>   # reverse the mask

Status & Inspection

sudo systemctl status <service>           # show status, recent logs
sudo systemctl is-enabled <service>       # enabled / disabled / masked
sudo systemctl is-active <service>        # active / inactive
systemctl list-units --type=service       # all running services
systemctl list-unit-files --type=service  # all installed services with enable state

Logs

journalctl -u <service>           # all logs for service
journalctl -u <service> -f        # follow live logs
journalctl -u <service> --since "1 hour ago"
journalctl -u <service> -n 50     # last 50 lines

Common service names

ServiceName
Nginxnginx
PostgreSQLpostgresql
MySQL / MariaDBmysql / mariadb
Dockerdocker
Redisredis-server
SSHssh

Service files live in /etc/systemd/system/ (custom) and /lib/systemd/system/ (system).


Quick reference table

CommandBootCurrently running
enable✅ starts on bootunchanged
disable❌ won’t start on bootunchanged
enable --now✅ starts on bootstarts now
disable --now❌ won’t start on bootstops now
mask❌ blocked entirelystops now
startunchangedstarts now
stopunchangedstops now

See also

  • update-rc.d — older SysV init alternative (rarely needed on modern Ubuntu)