Systemctl Commands: restart, reload, and stop Services in Linux

In modern Linux distributions that use systemd as the init system, managing services is commonly done using the systemctl command. Whether you’re an administrator maintaining a web server or a developer testing application changes, understanding how to restart, reload, and stop services is essential.

This article breaks down the most common systemctl commands with practical examples.

 What is systemctl?

systemctl is the command-line utility used to control the systemd system and service manager. It allows you to start, stop, restart, reload, enable, disable, and monitor services on your system.

1. Restarting a Service

Use this when you want to completely stop and then start a service again. It is useful after making configuration changes or when the service becomes unresponsive.

Syntax:

sudo systemctl restart <service-name>

Example:

sudo systemctl restart nginx
This stops and then starts the NGINX web server with updated settings.

 2. Reloading a Service

reload tells the service to reload its configuration without restarting the entire process. Not all services support this.

Syntax:

sudo systemctl reload <service-name>

Example:

sudo systemctl reload apache2
Apache will reload its configuration without disrupting active connections.

Tip:

You can check if a service supports reload:

systemctl show <service-name> | grep CanReload

3. Stopping a Service

Use this command to terminate a running service. It will remain inactive until you manually start it again or reboot the system (unless it is enabled at boot).

Syntax:

sudo systemctl stop <service-name>

Example:

sudo systemctl stop mysql
This stops the MySQL database server.

Conclusion

Mastering systemctl commands like restart, reload, and stop is key to managing services efficiently in Linux. They allow you to apply updates, fix issues, and control system behavior with precision.

Always remember to verify changes using:

systemctl status <service-name>