HOWTO: StartX automatically on Login – Ubuntu


For those wanting a lightweight system, Gnome applications like GDM are simply too big.

Here’s a quick and simply way to startup your graphical environment automatically from the command line login, be it Gnome or Openbox.

This howto comes with help from the Arch Wiki.

First open up a terminal (Applications>Accessories>Terminal) and type

sudo cp /etc/skel/.profile ~/

This copies a skeleton bash .profile to your home directory. Next, open it up with your preferred text editor or simply use

nano ~/.profile

Next, type the following at the bottom of the script, or if you can copy and paste, copy the following, and use Shift+Ctrl+Ins to paste it.

#Startx Automatically
if [[ -z "$DISPLAY" ]] && [[ $(tty) = /dev/tty1 ]]; then
 . startx

If using nano, press Ctrl+X then Shift+Y to exit and save.

That’s it. When you reboot next, simply type in your user name and password, and X will start up automatically.


6 Responses to “HOWTO: StartX automatically on Login – Ubuntu”

  1. 1 Just Me

    just what I was looking for 🙂

  2. 3 gaurav

    thank you……………..

  3. 5 David

    did not work on ubuntu 12.04 LTS.
    there is a note in the file that mentions that the file is not read by bash, if ~/.bash_profile or ~/.bash_login exists

    • 6 Fred Wyatt

      Thank you, but it didnt work on my Ubuntu 12.04 LTS either. Is there a modification required?

%d bloggers like this: