In Red Hat Enterprise Linux 6, system initialization is controlled by runlevels. The default GUI mode runs at runlevel 5, while pure text mode operates at runlevel 3. Here's how to verify your current runlevel:
# Check current runlevel
$ runlevel
N 5
# List all available runlevels
$ chkconfig --list | grep runlevel
To permanently disable the GUI and boot into text mode:
# Edit the /etc/inittab file
$ sudo vi /etc/inittab
# Change this line:
id:5:initdefault:
# To:
id:3:initdefault:
# Save and reboot
$ sudo reboot
If you need occasional access to text mode without permanent changes:
# Stop the GUI service (GNOME example)
$ sudo service gdm stop
# Or for KDE
$ sudo service kdm stop
# To restart GUI later
$ sudo service gdm start
After reboot, confirm you're in text mode:
# Check current runlevel
$ runlevel
N 3
# Verify no X server is running
$ ps aux | grep X
For pure shell scripting practice, consider:
# Create minimal .bashrc for scripting
$ cat > ~/.bashrc_clean <
If you need to restore the GUI later:
# Edit /etc/inittab again
$ sudo vi /etc/inittab
# Change back to:
id:5:initdefault:
# Reboot or start GUI service
$ sudo service gdm start
In Red Hat Enterprise Linux 6, the system uses traditional SysV init with defined runlevels. The key runlevels for this purpose are:
Runlevel 3 - Multi-user mode with networking (command line) Runlevel 5 - Graphical mode with networking (default for most installations)
To permanently disable the GUI and boot directly to command line:
- Open the /etc/inittab file with your preferred text editor:
- Locate the line specifying the default runlevel (typically near the top):
- Change the number 5 to 3:
- Save the file and exit
- Reboot for changes to take effect:
vi /etc/inittab
id:5:initdefault:
id:3:initdefault:
reboot
If you want to switch to command line temporarily without changing the default runlevel:
init 3
To return to graphical mode later:
init 5
You can check your current runlevel with:
runlevel
Or more detailed system information with:
who -r
To prevent GUI services from starting even in runlevel 3:
chkconfig gdm off chkconfig prefdm off
To verify these services are disabled:
chkconfig --list | grep -E 'gdm|prefdm'
Note that later RHEL versions use systemd. For completeness, here's the systemd equivalent:
systemctl set-default multi-user.target # For command line systemctl set-default graphical.target # To revert back