Almost every modern Linux distribution — Ubuntu, Debian, AlmaLinux, Rocky, Fedora — uses systemd to start and supervise services. systemctl is the command you use to control it. These are the commands you’ll reach for daily on a server.

Start, stop, restart, reload

sudo systemctl start nginx
sudo systemctl stop nginx
sudo systemctl restart nginx       # stop + start
sudo systemctl reload nginx        # re-read config without stopping (if supported)
sudo systemctl reload-or-restart nginx

Prefer reload for web servers and databases that support it: active connections aren’t dropped. For Nginx, always run sudo nginx -t first — a reload with a broken config fails, but a restart with a broken config leaves you with no web server.

The .service suffix is optional: nginx and nginx.service are the same.

Enable at boot

sudo systemctl enable nginx          # start at boot
sudo systemctl disable nginx         # don't start at boot
sudo systemctl enable --now nginx    # enable AND start immediately
sudo systemctl disable --now nginx   # disable AND stop
systemctl is-enabled nginx

start and enable are independent: a service can be running but not enabled (gone after reboot), or enabled but currently stopped.

Check status

systemctl status nginx
● nginx.service - A high performance web server and a reverse proxy server
     Loaded: loaded (/usr/lib/systemd/system/nginx.service; enabled; preset: enabled)
     Active: active (running) since Tue 2026-11-04 09:12:01 UTC; 2h ago
   Main PID: 812 (nginx)
      Tasks: 3 (limit: 2307)
     Memory: 6.1M
        CPU: 1.204s
     CGroup: /system.slice/nginx.service
             ├─812 "nginx: master process /usr/sbin/nginx"
             └─813 "nginx: worker process"

The important lines:

  • Loaded — where the unit file is, and whether it’s enabled.
  • Active — active (running), inactive (dead), failed, or activating.
  • The last few log lines appear at the bottom.

For scripts, use the quiet checks:

systemctl is-active nginx     # prints "active", exit code 0 if running
systemctl is-failed nginx

Add --no-pager to stop status from opening a pager, and -l to show full log lines.

List services

systemctl list-units --type=service                 # loaded and active
systemctl list-units --type=service --state=running
systemctl list-unit-files --type=service            # everything installed, with enabled state
systemctl --failed                                  # failed units

systemctl --failed is a good first command after a reboot or when something feels wrong.

Read the logs

systemd collects each service’s output in the journal:

journalctl -u nginx               # all logs for the unit
journalctl -u nginx -f            # follow
journalctl -u nginx --since "1 hour ago"
journalctl -u nginx -n 100 --no-pager

Full guide: journalctl: reading systemd logs.

When a service fails

systemctl status myapp
journalctl -u myapp -n 50 --no-pager

Typical causes: a config syntax error, a port already in use, a missing file, the wrong user or permissions, or the executable path not found. After fixing it:

sudo systemctl reset-failed myapp    # clear the failed state
sudo systemctl start myapp

If a service crashed too often, systemd stops restarting it (start-limit-hit); reset-failed clears that too.

Mask: block a service completely

sudo systemctl mask apache2      # can't be started, even manually or as a dependency
sudo systemctl unmask apache2

Useful when two services fight over the same port, for example Apache and Nginx on port 80.

Inspect and edit unit files

systemctl cat nginx                  # show the unit file (and drop-ins)
systemctl show nginx -p ExecStart -p User -p Restart   # specific properties
sudo systemctl edit nginx            # create a drop-in override
sudo systemctl edit --full nginx     # edit a full copy of the unit
sudo systemctl daemon-reload         # after changing unit files by hand

systemctl edit creates /etc/systemd/system/nginx.service.d/override.conf. Overrides survive package upgrades, unlike edits to files in /usr/lib/systemd/system/. For example, to make a service restart automatically on failure:

[Service]
Restart=on-failure
RestartSec=5

To write your own service from scratch, see systemd unit files.

Dependencies

systemctl list-dependencies nginx            # what nginx needs
systemctl list-dependencies --reverse nginx  # what needs nginx

System state: reboot, power off, targets

sudo systemctl reboot
sudo systemctl poweroff
systemctl get-default              # usually multi-user.target on servers
sudo systemctl isolate rescue.target   # single-user rescue mode (careful over SSH!)

Isolating rescue.target over SSH disconnects you; use your provider’s VNC console for that.

Timers

systemd timers are a modern alternative to cron:

systemctl list-timers

shows every scheduled timer and when it next runs — certbot, apt updates, logrotate and more. See systemd timers.

User services

Regular users can run their own services (no sudo) with --user:

systemctl --user enable --now myapp
loginctl enable-linger $USER     # keep user services running after logout

Quick reference

Task Command
Start / stop systemctl start|stop NAME
Restart / reload systemctl restart|reload NAME
Boot behaviour systemctl enable|disable [--now] NAME
Status systemctl status NAME
Failed units systemctl --failed
Logs journalctl -u NAME -f
Override settings systemctl edit NAME
Reload unit files systemctl daemon-reload
Block a service systemctl mask NAME

These commands work the same on every Linux VPS distribution we offer — Ubuntu, Debian and the RHEL family.

  • Linux
  • systemd
  • Command Line