systemd & Services — Managing Daemons with systemctl
Manage Linux system services with systemctl — start, stop, enable, disable, and monitor services using systemd.
March 26, 20255 min read
linuxsysadminsystemdsystemctlservices
What is systemd?
systemd is the init system on most modern Linux distros. It manages:
- Services (daemons) like nginx, ssh, docker
- Boot targets — groups of services (like old runlevels)
- Boot process — starts services in the right order
Service Control
sudo systemctl start nginx # Start service now
sudo systemctl stop nginx # Stop service
sudo systemctl restart nginx # Stop then start
sudo systemctl reload nginx # Reload config (no downtime)
sudo systemctl status nginx # Check if running + recent logsEnable / Disable at Boot
sudo systemctl enable nginx # Start automatically at boot
sudo systemctl disable nginx # Don't start at boot
sudo systemctl is-enabled nginx # Check if enabledList Services
systemctl list-units --type=service # Running services
systemctl list-units --type=service --all # All services
systemctl list-unit-files --type=service # All service files
systemctl list-units --failed # Failed servicesUnderstanding Status Output
sudo systemctl status nginx
# ● nginx.service - A high performance web server
# Loaded: loaded (/lib/systemd/system/nginx.service; enabled)
# Active: active (running) since Mon 2025-03-26 10:00:00
# Main PID: 1234 (nginx)
# Tasks: 3
# Memory: 5.2MSystem Power Commands
sudo systemctl reboot # Reboot system
sudo systemctl poweroff # Shutdown
sudo systemctl suspend # Sleep/suspend
systemctl get-default # Show current boot targetUse sudo systemctl enable --now nginx to both enable at boot AND start the service immediately in one command.
Quick Check
What does `systemctl enable nginx` do?
Exercise
Check the status of the ssh (or sshd) service. Then list all currently running services.