-->
🏠 🔍
SHAREOLITE

How to change Linux default run level - command line , single user , X11


Linux server supports different run levels for its users i.e, a Administrator may choose whether the users should be presented with a Graphical user interface ( GUI) / X windows or only through a command line or single user mode where only the administrators get access.

Below is a method on how to change the default run level in Redhat Linux.

Login as root user and edit the file /etc/inittab

vim /etc/inittab

You will notice the below lines which indicate different levels supported. Note the last line initdefault. The init value entered here indicates the default run level.

# Default runlevel. The runlevels used by RHS are:
#   0 - halt (Do NOT set initdefault to this)
#   1 - Single user mode
#   2 - Multiuser, without NFS (The same as 3, if you do not have networking)
#   3 - Full multiuser mode
#   4 - unused
#   5 - X11
#   6 - reboot (Do NOT set initdefault to this)
#

id:5:initdefault:

By default X windows will be enabled i.e, value 5 . If you wish to disable and enable only command line option select value 3 and save the file.

Test it by rebooting the system and confirm.

Also you can execute the below init commands manually in a console as a root user to serve your purpose

  • init 0      - (shuts down the system)
  • init 6      - (reboots the system )
  • init 3      - (opens command mode)
  • init 5      - (opens X windows mode )

Hope this is useful to some beginners.

Comments

–>