If you planned to install a CentOS server, but mistakenly also installed Desktop Environment such as GNOME, you can easily remove the GUI packages and return back to Command Line (CLI).
There are two ways to do that. You can simply disable GUI or completely uninstall it. I will provide steps to do both.
Disable GUI (GDM)
change id:5:initdefault: to id:3:initdefault:
If you want to remove all GUI packages completely, please still use the disable GUI steps first otherwise once Gnome, GDM, X Windows removed CentOS will still try to load X Window.
To remove GUI packages follow the steps:
yum groupremove "GNOME Desktop Environment" -y
yum groupremove "X Window System" -y
If you want to temporarily stop GDM (GUI), you can issue this command:
and then back to start GDM:
If you have any questions please post in comments.