How to Manage ‘Systemd’ Services and Units Using ‘Systemctl’ in Linux

Page 1 of 212

If You Appreciate What We Do Here On TecMint, You Should Consider:

  1. Stay Connected to: Twitter | Facebook | Google Plus
  2. Subscribe to our email updates: Sign Up Now
  3. Use our Linode referral link if you plan to buy VPS (it starts at only $10/month).
  4. Support us via PayPal donate - Make a Donation
  5. Support us by purchasing our premium books in PDF format.
  6. Support us by taking our online Linux course in 5 Days

We are thankful for your never ending support.

Receive Your Free Complimentary eBook NOW! -

Download Free Linux eBooks

Advanced Bash-Scripting Guide
Linux Bible
A Newbie's Getting Started Guide to Linux
Introduction to Linux - A Hands on Guide

You may also like...

16 Responses

  1. Frank says:

    I would like to know about the relationship of numbering of files such as this in your teachings:
    90-CPUShares.conf

    I used a similar scheme with a .network file as seen in some tutorials. For Example:
    10-dhcp.network
    20-static.network
    30-static.network
    My belief is that the lower number .network file starts first?? Are these just arbitrary numbers? Could I use 70-dhcp.network&80.dhcp.network in the same fashion?? 99-* seems to be the last number called up.

    Also these numbers schemes look like what I see in UDEV as well…

    Keep up the great work

  2. Frank says:

    Really useful guide.
    Keep up the great work.
    I see one command not covered that I use alot.
    systemctl reenable
    This allows the unit file to reload and writes a new symbolic link to /usr/lib/

    I have also found the systemctl edit –full allows you to edit the unit control file in /etc/systemd/system folder. Helpful for setting the After= setting for controlling the startup order of services.

    • Ravi Saive says:

      @Frank,

      Thanks for appreciating our work and giving us valuable tip, we’ve will check and add to the list as per your suggestions.

      • Frank says:

        Thank You
        Just to be clear the “systemctl edit –full” needs a service to work on. For example:
        systemctl edit –full hostapd

        To this file I add-
        After=dnsmasq.service
        To have hostapd wait for dnsmasq to start first.

        It saves the file with an odd file extension that is actually the unit file. Just edit and save(ignore name). Another advantage with this method is that it reloads and reenables the service thus writing the needed symbolic links for you with a single swoop.

  3. Jan Vlčinský says:

    Nice and extensive overview of available commands.

    Question: For controlling our applications we use supervisord, which allows one-shot commands as you present here, but also provides interactive shell, where one can call commands like “start svcA”, “restart svcB”, “tail svcA”, or even “follow mode” “tail -f svcA”. The interactive mode is very handy as it does not require typing so long commands.

    Question: is there any interactive console controlling systemd defined services?

    • Ravi Saive says:

      @Jan,

      Thanks for the tips, never ever heard about supervisord, let me check how it works and also to be fact I really don’t have any idea in controlling systemd via interactive shell, let me check and get back to you..

  4. Rizal Rahman says:

    very complete handy cheat sheet that i should bookmark it now! thanks!

  5. Jalal Hajigholamali says:

    Hi,
    Very nice article
    thanks a lot

  6. sys0dm1n says:

    Thanks, I am still running nix distro with init but will be useful some day when using systemd.

    • Avishek Kumar says:

      :) if you don’t start using systemd, you will be left behind in the fast moving Linux World.

  7. CertDepot says:

    ‘systemd –version’ doesn’t work. It is ‘systemctl –version’ that works.

    • Avishek Kumar says:

      try
      # systemd-run –version

      You may thank me later. :)

      • MCBuhl says:

        I’d thank you even more if yo’d correct it in the blog post – as I had the same error as CertDepot
        + copy-pasting runs into error, too, because “–” is altered into a long “-“: Failed to find executable –version: No such file or directory

  8. Bill M says:

    Thanks for the in-depth how-to on using the systemd control system tool. Lots of great examples!

Got something to say? Join the discussion.

Your email address will not be published. Required fields are marked *

Join Over 150K+ Linux Users
  1. 100,756
  2. 5,113
  3. 36,418

Enter your email to get latest Linux Howto's