How to Enable or Disable Services in Ubuntu Using Systemd?

In Linux, the services are a program that runs in the background outside the system user’s control. The services manage the program as a background process. The services can be enabled, disabled, restarted, or stopped to perform specific tasks.

This guide pens down the guidelines to enable or disable the Ubuntu services using “systemd”:

How to Enable Services Using Systemd?

The “systemd” is an init(initialization) system of Ubuntu. This system is managed through the “systemctl” command line tool. 

Check the service Status

Let’s check the service status, which will be enabled later in this guide: 

$ sudo systemctl status cron.service

The output shows that the “cron.service” is disabled. 

Enable the Service

To enable the services in Ubuntu, use the “systemctl” command with the “enable” keyword and the service name shown in the image:

$ sudo systemctl enable cron.service

The “cron.service” is enabled now. 

Restart the Service 

Execute the below-mentioned command to restart the service to make the changes effective:

$ systemctl restart cron.service

Verify the Service Status

Last, check the specified service status again for the verification purpose:

$ sudo systemctl status cron.service

The green indicator verifies that the “cron.service” has been enabled successfully.

How to Disable Services Using Systemd?

This section enlists the recommended steps to disable services in Ubuntu:

View the Service Status

The  “systemctl” command is used to check the “bluetooth.service” status:

$ sudo systemctl status bluetooth.service

The “bluetooth.service” is enabled. 

Disable the Service

Type the “bluetooth.service” name with the “systemctl” command:

$ sudo systemctl disable bluetooth.service

The command executed successfully.

Restart the Service

Restart the service to make the changes effective:

$ systemctl restart bluetooth.service

Confirm the Service Status

Check the status of the “bluetooth.service” again for verification using the below-mentioned command:

$  sudo systemctl status bluetooth.service

The “bluetooth.service” has been disabled permanently.

Conclusion

Ubuntu/Debian-based Linux systems offer the “systemctl” command to enable and disable the services.  To enable any service, use the syntax “sudo systemctl enable cron.service” and to disable any service, use the command “sudo systemctl disable cron.service”. This post briefly describes the complete procedure to enable and disable services in Ubuntu.