How to change between the cmdline interface and the GUI by editing the boot target.
First, we no longer use the runlevel term. Instead, we refer to boot choices as targets. The 2 primary targets here: multi-user.target (the CLI or runlevel 3 in legacy) and the graphical.target (the GUI or runlevel 5 in legacy).
To identify the current target:
$ sudo systemctl get-defeault
To launch GUI from the multi-user.target:
$ sudo systemctl isolate graphical.target
And to switch back to CLI mode:
$ sudo systemctl usolate multi-user.target
To set a default target
$ sudo systemctl set-default multi-user.target
To reboot and confirm the appropriate target:
$ sudo systemctl reboot
Target Files
Targets are managed by .target files that simply group units and dependencies into a convenient format. It;s really the .unit files that define exactly what services and other features start when the target is initiated.
$ sudo systemctl enable sshd
$ sudo systemctl disable sshd
Links: