Home / System Administration / systemctl

systemctl

Control systemd Services and System State

What Does It Do?

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 ]

When Should I Use It?

Start/Stop Services

Control running services like web servers, databases, and daemons.

Enable Auto-Start

Configure services to start automatically on system boot.

Check Service Status

View detailed status, logs, and health of running services.

Troubleshoot Issues

Restart crashed services and diagnose boot problems.

Common Commands

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.

IMPORTANT TIPS

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.

Try It Yourself

Practice systemctl commands in the interactive terminal below: