Controlling Services
Start / stop / restart
sudo systemctl start nginx
sudo systemctl stop nginx
sudo systemctl restart nginx # Stop then start
sudo systemctl reload nginx # Reload config without dropping connections
Enable / disable at boot
sudo systemctl enable nginx # Start automatically on boot
sudo systemctl disable nginx # Don't start on boot (doesn't stop it now)
sudo systemctl enable --now nginx # Enable AND start immediately
Mask a service (hard-disable)
sudo systemctl mask nginx # Prevents it from being started at all, even manually
sudo systemctl unmask nginx # Allows it again
Reload systemd itself after editing a unit file
sudo systemctl daemon-reload
Required any time you edit a .service file directly, so systemd picks up the changes.
Quick reference
| Command | Effect |
|---|---|
start | Run now |
stop | Stop now |
restart | Stop + start |
enable | Run on every boot |
disable | Don't run on boot |
status | Show current state |