« Back to Systemd: Frequently Asked Questions

How to start and enable a unit with systemctl

How to enable and start a unit with systemctl?

Use systemctl with the 'enabled' subcommand and --now option to enable and directly start a unit.

systemctl enable --now UNIT

After the installation of a software package or when configuring a custom unit, it may be needed to start the unit. In most cases, we also want our unit to start during boot time. There are a few ways to achieve this, let’s have a look.

Manual start and enable

First we start the unit using the start command.

systemctl start UNIT

After that, we enable the unit.

systemctl enable UNIT

If everything went well, the unit is now started and will also start during the next boot.

Combine the options

There is a quicker way to achieve the steps above. This is to enable the service and start it right away using the --now option.

systemctl enable --now UNIT

Same result, but in one command!

Check the status

After starting the service, have a look at the status of the unit to see if everything is expected.

systemctl status UNIT

Especially the line in the output with Loaded and Active will reveal if the unit is running and enabled.

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

Other questions related to Systemd

    Related articles

    Like to learn more? Here is a list of articles within the same category or having similar tags.

    Feedback

    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