Control systemd Services and System State
The systemctl command controls the systemd system and service manager, which is the init system used by most modern Linux distributions. It manages services (daemons), mounts, devices, and system states.
Think of systemctl like the control panel for all the background programs running on your Linux server. Just like Windows Services, you can start, stop, restart, and configure which services run automatically at boot. IT administrators use it to manage web servers (nginx, apache), databases (mysql, postgresql), SSH access, firewalls, monitoring tools, and any other background service. It's the standard way to control what's running on modern Linux systems.
Advertisement
[ Insert Google AdSense Banner Code Here ]
Control running services like web servers, databases, and daemons.
Configure services to start automatically on system boot.
View detailed status, logs, and health of running services.
Restart crashed services and diagnose boot problems.
systemctl list-units --type=service List all running services on the system.
systemctl status nginx Check the status of the nginx web server (detailed info).
sudo systemctl start nginx Start the nginx service immediately.
sudo systemctl stop nginx Stop the nginx service.
sudo systemctl restart nginx Restart nginx (stop then start - useful after config changes).
sudo systemctl enable nginx Enable nginx to start automatically at boot.
sudo systemctl disable nginx Disable nginx from starting at boot.
systemctl is-active nginx Quick check if nginx is running (returns "active" or "inactive").
systemctl is-enabled nginx Check if nginx is enabled to start at boot.
sudo systemctl daemon-reload Reload systemd configuration after creating/modifying service files.
Start vs Enable: start runs the service now. enable makes it auto-start at boot. They're independent!
After config changes: Always run systemctl restart to apply configuration changes to running services.
Check status first: Before troubleshooting, run systemctl status [service] to see detailed error messages and logs.
Practice systemctl commands in the interactive terminal below: