Change Runlevel in Linux with systemctl Command

Most Linux distributions use systemd as their init system. In systemd, we use the systemctl command to change runlevels. Also, you should know that, in systemd we identify runlevels as “targets”. For Example multi-user mode called as multi-user.target.

To get a list of available runlevels (targets) on your Linux System, Type:

systemctl list-units --type=target -a

Output will be the list of runlevels can be used in your Linux Machine as shown below.

UNIT                   LOAD      ACTIVE   SUB    DESCRIPTION
  basic.target           loaded    active   active Basic System
  bluetooth.target       loaded    active   active Bluetooth
  busnames.target        loaded    inactive dead   Bus Names
  cryptsetup.target      loaded    active   active Encrypted Volumes
  emergency.target       loaded    inactive dead   Emergency Mode
  getty.target           loaded    active   active Login Prompts
  graphical.target       loaded    active   active Graphical Interface
  local-fs-pre.target    loaded    active   active Local File Systems (Pre)
  local-fs.target        loaded    active   active Local File Systems
  multi-user.target      loaded    active   active Multi-User System
  network-online.target  loaded    inactive dead   Network is Online
  network-pre.target     loaded    inactive dead   Network (Pre)
  network.target         loaded    active   active Network
  nfs-client.target      loaded    active   active NFS client services
  nss-lookup.target      loaded    inactive dead   Host and Network Name Lookups
  nss-user-lookup.target loaded    active   active User and Group Name Lookups
  paths.target           loaded    active   active Paths
  remote-fs-pre.target   loaded    active   active Remote File Systems (Pre)
  remote-fs.target       loaded    active   active Remote File Systems
  rescue.target          loaded    inactive dead   Rescue Mode
  rpcbind.target         loaded    inactive dead   RPC Port Mapper
  shutdown.target        loaded    inactive dead   Shutdown
  slices.target          loaded    active   active Slices
  sockets.target         loaded    active   active Sockets
  sound.target           loaded    active   active Sound Card
  swap.target            loaded    active   active Swap
  sysinit.target         loaded    active   active System Initialization
● syslog.target          not-found inactive dead   syslog.target
  time-sync.target       loaded    inactive dead   System Time Synchronized
  timers.target          loaded    active   active Timers
  umount.target          loaded    inactive dead   Unmount All Filesystems

Change default Runlevel (Target) with systemctl command

To find out what is the default runlevel you are using currently, Type:

systemctl get-default

To change the default runlevel, type:

systemctl set-default <runlevel.target>

For Example, to set multi-user mode to default runlevel, Type:

systemctl set-default multi-user.target

In a Linux Desktop, default target should be graphical.target.

Switch between runlevels

We use systemctl isolate command to switch between systemd targets (This will not change the default target).

systemctl isolate multi-user.target

The above command will change Change runlevel to multi-user mode.