How to switch boot target to text or GUI in systemd Linux

You can switch the boot target to text or GUI mode in a system running Linux with systemd by performing the following steps:

  1. To switch to text mode, enter the following command in the terminal:
sudo systemctl set-default multi-user.target
  1. To switch to GUI mode, enter the following command in the terminal:
sudo systemctl set-default graphical.target
  1. To switch to the last target that you were using, enter the following command:
sudo systemctl isolate previous
  1. You can also see the current target by running:
systemctl get-default

Please note that these commands will take effect on the next reboot, if you want to switch the target immediately, you can use the following command:

sudo systemctl isolate target_name

It’s always a good idea to check the systemd website for the latest version and other options.

Also, it’s recommended to check the bootloader and the default target in the bootloader, in some cases the bootloader might be set to a different target than the systemd.

Additionally, some distributions might use different names for the target, for example, Ubuntu uses "graphical.target" instead of "gui.target", so please check the documentation of your distribution for the correct target names.

Leave a Comment