Managing Linux Services with systemctl
Systemd is the default init system on most modern Linux distributions. The systemctl command is the primary tool for managing services. This article covers the most common operations.
1. Checking Service Status
To see whether a service is running:
systemctl status nginx
The output shows the active state, main PID, memory usage, and recent log entries. A green active running line means the service is healthy.
To list all running services:
systemctl list-units --type=service --state=running
2. Starting and Stopping Services
Start a service immediately:
systemctl start nginx
Stop a running service:
systemctl stop nginx
Restart a service:
systemctl restart nginx
Reload configuration without a full restart:
systemctl reload nginx
3. Enabling and Disabling Services
Enable a service so it starts automatically at boot:
systemctl enable nginx
Disable a service so it does not start at boot:
systemctl disable nginx
Enable and start in one command:
systemctl enable --now nginx
4. Viewing Logs with journalctl
Systemd collects logs through journald. View logs for a specific service:
journalctl -u nginx
Follow logs in real time:
journalctl -u nginx -f
Show only the last 50 entries:
journalctl -u nginx -n 50
Filter by time range:
journalctl -u nginx --since "2026-06-10" --until "2026-06-11"
5. Editing Service Files
Override a service configuration without modifying the package-supplied file:
systemctl edit nginx
This opens an editor with a drop-in override file. Changes take effect after reloading:
systemctl daemon-reload
systemctl restart nginx
6. Common Troubleshooting Steps
When a service fails to start:
- Check the status output for error messages
- Review recent logs with journalctl -u servicename -n 50
- Verify the configuration file syntax
- Check if required dependencies are available
- Look at the service unit file for path or permission issues
A service stuck in failed state can be reset:
systemctl reset-failed nginx
Summary
systemctl provides a consistent interface for service management across most Linux distributions. The most frequently used commands are status, start, stop, restart, enable, and disable. Combined with journalctl for log review, these tools cover the majority of day-to-day service administration tasks.