Change from text login to graphical login in Linux

Change from text login to graphical login – 1.2

Learn how to start the X Window System automatically when your Linux system boots up, so you’ll have a graphical login. Or vice versa: if you’re already booting to X Windows, learn how to boot to the command line.

/etc/inittab >

Booting to X Windows, so you can have a graphical login in Linux, is a very simple thing to do. Or, disabling the X Window System from starting at bootup, so you’ll have a text login, is just as simple. Maybe your distro provides some fancy GUI tools for configuring this, but here I’ll concentrate on the fool-proof method that doesn’t need any weird config tools and thus works on any Linux distro: editing the /etc/inittab file.

You need to be root in order to edit this file. If you’re logged in as a normal user, get the root privileges with the su command: type the command and then the root password.


Now you can open the /etc/inittab file with your favorite text editor. It can be any editor you’re familiar with.

Changing the runlevel >

The /etc/inittab file is usually commented well, so the file itself explains what the lines in the file mean. Look for a line like this:

The line is usually at the beginning of the /etc/inittab file, and the number doesn’t necessarily have to be 3. The number in that line tells what’s the default runlevel of your system. The default runlevel in turn specifies what processes are started when your Linux system boots up. So, you need to change the number that indicates your default runlevel in order to specify if you want to start the X Windows when your Linux system boots up.

The number of the runlevel that starts X isn’t always the same in all Linux distros. That’s why you’ll have to read the /etc/inittab file a bit more. It explains what number and what runlevel is used for graphical and text login. If you want to boot to X Windows, you’ll choose a “full multiuser with xdm” or “full multiuser with graphical login” or something similar. If you want to boot to the command line, you’ll choose a runlevel that says something like “full multiuser” or “full multiuser with text login” or “full multiuser with no graphical login” or something like that.

In Red Hat (and maybe in other Red Hat based distros, too) the runlevel for booting to X Windows is 5, and for a text login it’s 3 by default. This is the case in newer versions of SuSE, too. In older SuSE’s it was 2 for a text login, and 3 for a graphical login. So, for example, if you want a graphical login in a Red Hat based distro, you’ll change

However, check out your inittab file to see what’s the number of the runlevel in your distro, and then replace the number in the line to indicate the runlevel you want. Then save the changes, and tada: you’re done!

Display manager >

If you’re booting to X Windows, you’ll need a display manager. It’s a graphical program that takes care of your login: it shows you a graphical login screen, lets you type in your username and password, and starts your favorite window manager after you’ve logged in.

In most modern Linux distros you don’t have to worry about this. Usually they install a display manager by default, so all you have to do is change the runlevel and the next time you boot your system, it automatically starts the display manager.

However, if something goes wrong and the X Window System doesn’t start and you end up with a text login anyway, you probably don’t have a display manager installed. Then you’ll have to install and configure one of the display managers, like the KDE display manager kdm, Gnome display manager gdm, the ye olde xdm (my favorite), or some other. Installing and using a graphical display manager isn’t the subject of this tuXfile anymore, so read your distro’s documentation or do some googling on the topic.

The startx command >

Of course, if you just disabled the graphical login, you’ll need to start X manually when you want the GUI. Just type the startx command and the X Window System starts up.

If X tries to start up but throws you back to the command line, the reason probably is that X doesn’t know what window manager you wish to use. Or if X starts up just fine but you get a way different desktop than usually, you also need to tell X what window manager you want to use. In this case, take a look at the Changing the default window manager tuXfile.