How to Change Runlevels (targets) in SystemD

Systemd is a modern init system for Linux: a system and service manager which is compatible with the popular SysV init system and LSB init scripts. It was intended to overcome the shortcomings of SysV init as explained in the following article.

  1. The Story Behind ‘init’ and ‘systemd’: Why ‘init’ Needed to be Replaced with ‘systemd’ in Linux

On Unix-like systems such as Linux, the current operating state of the operating system is known as a runlevel; it defines what system services are running. Under popular init systems like SysV init, runlevels are identified by numbers. However, in systemd runlevels are referred to as targets.

Suggested Read: Managing System Startup Process and Services (SysVinit, Systemd and Upstart)

In this article, we will explain how to change runlevels (targets) with systemd. Before we move any further, let’s briefly under the relationship between runlevels numbers and targets.

  • Run level 0 is matched by poweroff.target (and runlevel0.target is a symbolic link to poweroff.target).
  • Run level 1 is matched by rescue.target (and runlevel1.target is a symbolic link to rescue.target).
  • Run level 3 is emulated by multi-user.target (and runlevel3.target is a symbolic link to multi-user.target).
  • Run level 5 is emulated by graphical.target (and runlevel5.target is a symbolic link to graphical.target).
  • Run level 6 is emulated by reboot.target (and runlevel6.target is a symbolic link to reboot.target).
  • Emergency is matched by emergency.target.

How to View Current target (run level) in Systemd

When the system boots, by default systemd activates the default.target unit. It’s main work is to activate services and other units by pulling them in via dependencies.

To view the default target, type the command below.

#systemctl get-default 

graphical.target

To set the default target, run the command below.

# systemctl set-default multi-user.target  

How to Change the target (runlevel) in Systemd

While the system is running, you can switch the target (run level), meaning only services as well as units defined under that target will now run on the system.

To switch to runlevel 3, run the following command.

# systemctl isolate multi-user.target 

To change the system to runlevel 5, type the command below.

# systemctl isolate graphical.target

For more information about systemd, read through these useful articles:

  1. How to Manage ‘Systemd’ Services and Units Using ‘Systemctl’ in Linux
  2. How to Create and Run New Service Units in Systemd Using Shell Script
  3. Managing System Startup Process and Services (SysVinit, Systemd and Upstart)
  4. Manage Log Messages Under Systemd Using Journalctl [Comprehensive Guide]

In this guide, we showed how to change runlevels (targets) with systemd. Use the comment form below to send us any questions or thoughts concerning this article.

Aaron Kili
Aaron Kili is a Linux and F.O.S.S enthusiast, an upcoming Linux SysAdmin, web developer, and currently a content creator for TecMint who loves working with computers and strongly believes in sharing knowledge.

Each tutorial at TecMint is created by a team of experienced Linux system administrators so that it meets our high-quality standards.

Join the TecMint Weekly Newsletter (More Than 156,129 Linux Enthusiasts Have Subscribed)
Was this article helpful? Please add a comment or buy me a coffee to show your appreciation.

12 thoughts on “How to Change Runlevels (targets) in SystemD”

  1. What’s the equivalent of run-level 2? i.e. multi-user, but no networking.

    Troubleshooting some (probable) networking issues that prevent the server from fully booting. Normally I would boot into run-level 2, so I have multi-user, but without networking enabled.

    Reply
  2. There used to be a good GUI graphical interface for viewing enabling and disabling stuff on the various runlevels… what happened to that?

    Reply
  3. Thanks for the clear, concise explanation. It is needed and appreciated. However, I’m looking for a way to find the current target, not necessarily the same thing as the default target.

    I’m writing a script using the runlevel man page as a guide. Some bright soul pointed out `who -r` gives the current run level (but not target). There should be an easier way (like get.target or similar).

    Have I missed something? TIA.

    Reply
  4. Nice article and helpful info since I did need to know this.

    Unfortunately I needed to look up something this simple as systemd is change for change sake and is unnecessarily over complicated.

    There was nothing wrong with # init 3

    Reply
  5. Thanks. This is well written. I had read another source that did not mention the graphical target so I ended up without a GUI for a while :)

    Reply
    • @Fred

      Ooops, that’s correct. We will update the article soon; it is supposed to read:
      “Run level 0 is matched by poweroff.target (and runlevel0.target is a symbolic link to poweroff.target)”

      Reply

Leave a Reply to Tim Kissane Cancel reply

Thank you for taking the time to share your thoughts with us. We appreciate your decision to leave a comment and value your contribution to the discussion. It's important to note that we moderate all comments in accordance with our comment policy to ensure a respectful and constructive conversation.

Rest assured that your email address will remain private and will not be published or shared with anyone. We prioritize the privacy and security of our users.