How to boot CentOS 7 into Command Line or GUI Mode
In CentOS 7 we can use the systemctl command to select which mode the OS boots into. If you have a GUI like Gnome or KDE installed, it’s easy to boot directly into your preferred environment.
To find out what mode CentOS is currently using, use this:
This will give you one of two “targets”, either
- multi-user.target (the command line), or
- graphical.target (the Windows-like GUI)
To change from one to the other, use one of these commands:
systemctl set-default multi-user.target systemctl set-default graphical.target
What happened to runlevels?
In previous versions of CentOS, switching boot modes was achieved through runlevels. Those were saved in /etc/inittab, but this file is no longer used by CentOS 7 and above. However, the file still exists and contains a little extra info this matter, including how to change boot modes:
# multi-user.target: analogous to runlevel 3 # graphical.target: analogous to runlevel 5 # # To view current default target, run: # systemctl get-default # # To set a default target, run: # systemctl set-default TARGET.target