« Back to Frequently Asked Questions

How to disable a systemd unit with systemctl

Sometimes a systemd unit, like a service, should not be starting during boot time or not at all. Let’s have a look how to disable a systemd unit.

Completely disable a unit

The most strict method is to disable a unit using the mask command.

systemctl mask UNIT

With the service masked, it won’t be able to start it anymore. Only when using the unmask command, it can be reactivated again.

Disable during boot

Just want to disable the unit so it won’t be started during the boot process? Then we use the disable command.

systemctl disable UNIT

After changing the service, have a look at it. In the line starting with Loaded, it should list ‘disabled’ after the unit name.

Learn more about systemctl

This article uses the systemctl command to achieve its tasks. For this popular tool there is a cheat sheet available!

» Mastering the tool: systemctl

systemctl cheat sheet


Small picture of Michael Boelen

This article has been written by our Linux security expert Michael Boelen. With focus on creating high-quality articles and relevant examples, he wants to improve the field of Linux security. No more web full of copy-pasted blog posts.

Discovered outdated information or have a question? Share your thoughts. Thanks for your contribution.

Mastodon icon