How to change runlevel in Linux with systemctl

Conventional method to change runlevel with /etc/inittab has changed. System and service manager command systemd is used. Runlevel have been replaced with targets. Although runlevel command, can still be used.

Below is comparison  of different runlevels and related targets

[table id=1 /]

View Run Level

This command will show current runlevel

runlevel
change runlevel

Check run level – systemd

In newer version of linux (RHEL 7 and Ubantu 16.04 onwards) runlevels have been replaced with systemd targets. If your system is using systemd as default manager, use below command to check current default run level

Syntax

systemctl get-default

This will present current default runlevel.

List available targets with systemctl

This command will show list of all loaded target

systemctl list-units --type target
change runlevel

Change runlevel

Runlevel can be changed for current session or permanently default runlevel can also be changed.

Below video shows how to change run level for current session and change of default run level.

Change current runlevel with systemctl

To change current level to any other runlevel

systemctl isolate name.target

Change default run level with systemctl

To change default runlevel

systemctl set-default <name of target>.target

Above commands replaces the /etc/systemd/system/default.target file with a symbolic link to /usr/lib/systemd/system/name.target.

These commands have been tested on fedora 25 and Redhat 7