CentOS – switch from GUI to terminal

You installed CentOS with the GUI and you want to remove it later? Instead of removing it, you can just switch the system from GUI to the terminal. For this, we will use systemd targets.

Below are the systemd targets used in RedHat/CentOS 7+:

RunlevelTarget UnitsDescription
0runlevel0.target, poweroff.target Shut down and power off the system.
1runlevel1.target, rescue.targetSet up a rescue shell.
2runlevel2.target, multi-user.targetSet up a non-graphical multi-user system.
3runlevel3.target, multi-user.targetSet up a non-graphical multi-user system.
4runlevel4.target, multi-user.targetSet up a non-graphical multi-user system.
5runlevel5.target, graphical.targetSet up a graphical multi-user system.
6runlevel6.target, reboot.targetShut down and reboot the system.

To switch from GUI to terminal/non-graphical user interface, use:

systemctl set-default multi-user.target
reboot
centos gui
CentOS GUI

To switch from terminal/non-graphical user interface to GUI, use:

systemctl set-default graphical.target
reboot
CentOS Non-GUI

Resources:
SYSTEMD TARGETS

Leave a Reply