Linux 101 : System security - Disabling unused services - Systemctl -



When we are running a system, stopping or disabling unused services could save resources, it also makes our system safer.

Displaying all the services on a system:



All the services with a plus sign [+], are running services, and all the services with a minus sign [-]are stopped services.

We could also use "systemctl" to list all the services


Stopping services:

We can stop a service using the below command:


Example:


We check if it was stopped:


We could also use "systemctl" as below:


Displaying enabled services:

Enabled services start at boot-time. We display them using:


Disabling a service:

The syntax to disable a service, so it doesn't start when the system boots is as below:


We check the status of the service (if it was disabled) using the below:



Checking the failed services:

We can check the "health" of services using:


Listing the configuration file of a service:

We can display the unit file (configuration file) using the below command:


Comments

Leave as a comment:

Archive