How to Start KDE from Command Line using startx

I don’t use xdm, gdm or kdm… I prefer my Linux booting to init 3. I like logging in to the command-prompt and starting X manually with startx. In my Fedora Linux box, I always get to gnome even both gnome and KDE are installed. Actually the startx script is already written for most of the modern desktop environment. What we need to do is open the “trigger”.

desktop  photo

The startx script in Fedora will read /etc/sysconfig/desktop for the “DESKTOP” variable (through /etc/X11/xinit/Xclients) and starts the desktop environment depending on it. While the default value for “DESKTOP” is set to “GNOME”, we will get to gnome if we don’t set the variable. When we want to startx to KDE we just need to add one line to /etc/sysconfig/desktop:


If there is already one line that defines “DESKTOP”, just change the value of it.

Then we will start KDE when we run startx from console.

Free additional gift

The “DISPLAYMANAGER” in the /etc/sysconfig/desktop file is used to specify the default display manager. To make KDM the default display, just add this line:


Eric Ma

Eric is a systems guy. Eric is interested in building high-performance and scalable distributed systems and related technologies. The views or opinions expressed here are solely Eric's own and do not necessarily represent those of any third parties.


  1. I’ve been looking for this, thanks. But, if I want to keep gnome as default desktop and occasionaly launch KDE? Is there any way to do this without modifying /etc/sysconfig/desktop (i.e.: $startx KDE , or so).

    Thanks again.

    1. OK, I’ve found it diving into /etc/X11/xinit/Xclients …

      For KDE, type:

      $startx /usr/bin/startkde

      For Gnome, type:

      $startx /usr/bin/gnome-session

      For a second session of X (gnome, for example), type:

      $startx /usr/bin/gnome-session — :1

      This works for me, if anyone knows a more elegant way, wellcome any comment.

      NOTE: typing “$startx startkde” doesn’t work althought /usr/bin is in my PATH, dont’t know why.

Leave a Reply

Your email address will not be published. Required fields are marked *