In this write-up, we will explore the methods to stop and manage the services on the Raspberry Pi operating system.
How to stop the services on the Raspberry Pi using the systemctl command
We have a system known as the systemd which manages all the services running on the Raspberry Pi and to manage the systemd, we use the systemctl command in the terminal. Let’s say we want to find out the status of the services running in the Raspberry Pi, we simply run the command:
These are the services running on the Raspberry Pi, now if we want to find out the status of any specific services, for understanding we will find the status of apache2 service using the systemctl command:
The service of Apache2 is in running status, now if we want to stop the service of Apache2, we will use the systemctl command:
It will ask the authentication permission, so provide the password of the sudo user and press on the “OK” button. We can skip this step if we used the keyword of “sudo” at the start of the above-mentioned command, after providing the password, it will stop the process:
To confirm the status of Apache2, we will again check the status by using the systemctl command:
The service of the Apache2 has been stopped, in a similar way we can manage any service running on the Raspberry Pi operating system by using the systemctl command.
How to stop the services on the Raspberry Pi using the service command
Another way to manage the services on the Raspberry Pi is by using the service command, to understand we will check the status of the ssh service by using the command:
The ssh service is in the running status, now if we want to stop the ssh service using the service command:
To confirm the status of the ssh service, run the command:
The SSH service has been successfully stopped.
Conclusion
Sometimes we want to stop the services because we are making the backup of the data or we want to reduce the load on the processor to improve the efficiency of the CPU of the Raspberry Pi. In this write-up, we have discussed the two different commands by which not only can stop any running service on the Raspberry Pi but also can check status, restart, and start the services.