How to Disable Unwanted Services on Debian Linux
Tags: linux, opensource, beginners
Published: 2021-10-04 13:22:17

Are all the unwanted services on your Debian system bothering you? Disabling unnecessary services helps boost performance and reduce vulnerabilities.

This article explains how to disable all the unwanted services on Debian Linux. So, let’s begin.

##Step 1 – Find the Unwanted Services
To find the services causing a performance lag, take a look at all the services running. Type the following code to see the existing programs in the terminal.

  sudo service --status-all

A list of programs will appear after executing the above code. Among these identify the running programs by the given plus (+) beside them. The programs having a minus (-) are not active.

##Step 2 – Disable the Unwanted Service Using Systemctl Command
Once you have decided on which programs to discard write the syntax given below.

 sudo systemctl disable <service>

For instance, if you don’t use apache, simply disable it to enhance the system performance. To disable apache, just type:

 sudo systemctl disable apache

After discarding the unused service, check the list executing the following code. 

 sudo service --status-all

And you’ll find that particular service has been deactivated. Now there will be a minus beside that program instead of a plus.

Another method of checking the disabled service is using the following syntax.

 sudo service <service> status

This will give you the current status of that particular service you deactivated.

##Step 3 – Managing Services through Systemd

Now, most of the Linux distros use Systemd. It’s a service manager that assigns a cgroup (control group) to each of the services in your system. It also tracks the processes.

Below are the commands to use to perform the respective tasks through systemd.

####Manage Services
To manage services, type:

 systemctl status

####Audit Health of the Device
To audit health of the device, execute:

 systemctl --failed

####List Unit Files
Unit files are comprised of details about devices, sockets, mount points, swap, and partition. They may contain more information. To list unit files installed, execute:

 systemctl list-unit-files

####List Running Services
List all the running services with:

 systemctl

####Start or Stop a Service
Below is the syntax for starting a service.

 systemctl start <Service-name>

Alternately you can use:

 sudo service <Service-name> start

For stopping a service, just replace “start” with “stop” in the code.

And for restarting, type:
 systemctl restart <Service-name>

####Show Status of a Service
The syntax for showing the status of a service is:

 systemctl status <Service-name>

You can also use the following command syntax to check the service status.

 sudo service <Service-name> status

####Enable or Disable a Service
To make a service activate every time the system boots, use:

 systemctl enable <Service-name>

Similarly, when you want to disable a service, just replace “enable” with “disable” in the command.

##The Conclusion
Fortunately, in open source systems, you can delete or disable any service that is not needed. Disabling a service on Debian has the following advantages:

a. It helps boot your Linux system faster.
b. When you disable a service instead of removing its components, the chance of everything being broken permanently reduces.
c. After deactivating you can again reactivate a service in case any essential program stops working.

I hope this article serves your purpose and now you have understood how to disable a service on Debian.