How to List and Manage Linux Services with systemctl
On modern Linux (Ubuntu, Debian, AlmaLinux, CentOS), systemd manages background services and you control them with the systemctl command. This guide covers listing, starting, stopping and troubleshooting services.
1. List services
systemctl list-units --type=service # running services
systemctl list-units --type=service --all # all, including stopped
systemctl list-unit-files --type=service # every installed service + boot state
systemctl --failed # only failed services2. Check a service’s status
systemctl status nginx # detailed status + recent log lines
systemctl is-active nginx # active / inactive
systemctl is-enabled nginx # enabled / disabled at boot3. Start, stop, restart, reload
sudo systemctl start nginx # start now
sudo systemctl stop nginx # stop now
sudo systemctl restart nginx # restart
sudo systemctl reload nginx # reload config without dropping connections4. Enable or disable at boot
sudo systemctl enable nginx # start automatically 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 immediately5. Mask a service (prevent it from starting)
sudo systemctl mask apache2 # fully block a service
sudo systemctl unmask apache2 # allow it again6. View service logs
journalctl -u nginx # all logs for a service
journalctl -u nginx -f # follow live (Ctrl+C to stop)
journalctl -u nginx --since "1 hour ago"
journalctl -u nginx -p err # only errors7. After editing a service file
sudo systemctl daemon-reload # reload systemd after changing unit filesTip: replace nginx with any service — e.g. mysql, php-fpm, ssh, cron. Use systemctl status <service> first whenever something isn’t working — it shows whether the service is running and the last error lines.