Where to start First steps track · 15 stages
Linux Labs

systemctl — managing systemd services

cheat sheet · Ubuntu 24.04 · systemd 255 https://lab.dimsanych.ru/en/wiki/systemctl/

Cheat sheet

  • systemctl status nginx --no-pager state, no pager
  • sudo systemctl status nginx + the last journal lines
  • systemctl start nginx start it now
  • systemctl stop nginx stop it now
  • systemctl restart nginx restart it (drops connections)
  • systemctl enable --now nginx enable autostart and start it right away
  • systemctl cat nginx --no-pager the whole unit file
  • systemctl edit nginx open a drop-in override
  • sudo systemctl daemon-reload reread units after an edit
  • systemctl --failed list of failed units
  • sudo journalctl -xeu nginx why the unit failed

Options

enable and start are independent operations: enable only registers the unit for autostart, it doesn't touch the current session's service, so after enable without --now the service stays inactive until reboot or an explicit start. The reverse is also true: start without enable won't survive a reboot.

Loading…