You are on page 1of 1

How to boot CentOS 7 into Command Line or GUI Mode

CentOS-LogoIn 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, its easy to boot
directly into your preferred environment.

To find out what mode CentOS is currently using, use this:

systemctl get-default
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

===============

Open /etc/inittab in the editor (I use vim).

su -c 'vim -w /etc/inittab'

You will see line similar to the below on

id:3:initdefault:

You simply change the "3" to the runlevel you desire.


I changed it to "5" to start X at boot-up.
Save the file and exit.

You might also like