Commands for starting and enabling services

Hello everyone. I would like to know if there is a difference between the following commands and which one I should use: systemctl start ufw.service or systemctl start ufw. Thanks in advance and I wish you all happiness and creativity for the year ahead.


In both cases the proper link (if doesn’t exist) will be created for that particular service, so it can be started automatically … :slight_smile:

Thank you very much for your immediate and helpful reply. :smiley:

In this case both commands will do the same. But it is always better to specify the type. By default systemd will add .service. However if you try to start a timer or a mount unit or something that is not a service, leaving the suffix out can lead to an error.

1 Like

Thanks for your immediate and detailed explanation. In particular, I am interested in starting and enabling ufw and haveged. So, do you suggest that I should use ufw.service and haveged.service?


If you want to only start the service for your current session you can use

systemctl start ufw.service haveged.service

You can specify two (and more) units in the same command. However if you reboot you would need to do it again.

So better to run

systemctl enable ufw.service haveged.service

But this will start the service only with the next boot. You can also use the --now switch to start the enabled service immediately.

systemctl enable --now ufw.service haveged.service

Thanks, again. You could not be more detailed. :smiley:

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.