Switch boot target to CLI or GUI in systemd Linux
We will introduce how to configure systemd to boot our Linux server from CLI or GUI.
Ref: faq
I always encounter this problem in my lab that once Ubuntu GUI is installed, it will boot into GUI by default. But I prefer to boot into CLI for a server, as I cannot access the GUI remotely.
Here is how to switch the boot target to CLI or GUI in systemd Linux:
sudo systemctl set-default multi-user.target
We can then check the current target:
systemctl get-default
If we want to switch back to GUI, we can use:
sudo systemctl set-default graphical.target