Zet - How do I manage services using systemctl?

How do I manage services using systemctl?

Disable the Service

This prevents the service from starting automatically at boot:

sudo systemctl disable <service_name>

Replace <service_name> with the actual name of the service.

Stop the Service

If the service is already running, stop it:

sudo systemctl stop <service_name>

Mask the Service (Optional)

Masking a service ensures it cannot be started, even manually or as a dependency:

sudo systemctl mask <service_name>

This symlinks the service to /dev/null, making it effectively disabled.

To Unmask (if needed later):

If you need to unmask the service in the future:

sudo systemctl unmask <service_name>

Verify the Status

You can check the service’s status to confirm it’s not running and is disabled:

sudo systemctl status <service_name>

This will show the service’s state and whether it’s enabled or disabled.

[!see-more] 20250215113415#Stopping and Restarting Services

#systemctl #linux