Quick way to switch from KDE to GNOME or viceversa

This tip is submitted by reader Zacharie:

switchdesk is the command to switch from KDE to GNOME or viceversa. This command provides a simple method of choosing between the various desktop environments available under Fedora Core, Cent OS and Red Hat Enterprise Linux.

If X Windows is running, switchdesk will bring up a dialog box which allows the user to choose between the available desktops installed on the system.

Task: To switch from GNOME to KDE, use the command

$ switchdesk kde

Task: To switch from KDE to GNOME, use the command

$ switchdesk gnome

Please note that file ~/.Xclients, ~/.Xclients-default stores the currently selected desktop.

A note about other distros/BSD

switchdesk is RedHat and friends only command. If you are using different Linux distribution or FreeBSD, open ~/.xinitrc file and type full path to your desktop manager. For example, to use xfce4 desktop:
$ vi .xinitrc
Append following line (your path may be different use, which command to get exact path):

Save and close the file. Enjoy new desktop.

While login you will see option for different desktops (provided that all of them are installed). Usually this is located below Username / password box or lower left button. Just select appropriate desktop (KDE/XFC4 etc).

Load KDE while running Gnome

You can load KDE while running Gnome desktop (thanks to sweta for pointing it out):
Just open your gnome terminal and type the command:
$ startkde &

🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 18 comments so far... add one

CategoryList of Unix and Linux commands
Disk space analyzersdf ncdu pydf
File Managementcat cp mkdir tree
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network UtilitiesNetHogs dig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
18 comments… add one
  • n00b Sep 7, 2006 @ 23:03

    excellent tip. I am using fedora core 5 and switch desk is good for swithing desktops

  • ubuntus Sep 8, 2006 @ 20:48

    any way this can be used on any of the UBUNTU variants?

  • Alejandro Sep 9, 2006 @ 0:11

    great tip…but it’s “X Window” isn’t it?

  • Homericious Sep 9, 2006 @ 4:00

    Foul! Doesn’t work! Command isn’t found and can’t be installed via “apt-get”. Not a standard X command!

  • nick Sep 10, 2006 @ 19:34

    I’d like to see Gnome and KDE Running at the same time using XGL – imagine ctrl and the desktop swizzles round in all its XGL glory with a different desktops on different faces of the cube. That would be really sweet!

  • delfick Sep 12, 2006 @ 10:38

    once using the startkde command, how do I close kde and return to gnome?

    also it doesn’t close gnome, as i can still see and use the gnome-panel

    also, would it even be possible to have kde on one face of the cube, and gnome on the other?

  • Skyler Sully Feb 28, 2007 @ 5:17

    Well, I know this is a little late and wrong, but the answer to quitting kde after you start it with the startkde command is:

    > kdeinit_shutdown

  • charl Jan 13, 2009 @ 20:26

    you didnt answer all the questions and problems, I also dont have the switchdesk command on my system

  • jec Jan 22, 2009 @ 8:50

    Thanks! worked perfectly!

  • John Doe Jan 24, 2009 @ 17:47

    The problem I have is that Fedora 10 is telling me:
    bash: switchdesk: command not found

  • 2pac Feb 1, 2009 @ 14:34

    John Doe: as root, run: yum install switchdesk
    Press “Y” when you get asked to install packages…

    Then you will have switchdesk 🙂

  • Mukul Apr 24, 2009 @ 12:39

    How to know through command line which GUI i m in linux ..

    Like If i am using KDE, it should say it

  • zouhei Dec 2, 2009 @ 15:58

    thank you so much for this article , it helped me a lot in my school work

  • Jake Jan 6, 2011 @ 18:59

    @ Homericious

    Same thing happening over here.

  • jitender Apr 27, 2011 @ 9:59

    i have redhat5. how can i install vlc player

  • Gonz Aug 30, 2011 @ 16:11

    i can’t quit kde using de command kdeinit_shutdown. it says: Warning: connect() failed: : No such file or directory
    Error: Can’t contact kdeinit!

    what should i do?

  • pravin wanjal Jan 10, 2012 @ 11:01

    really its nice…

  • pravin wanjal Jan 10, 2012 @ 11:02

    the command switchdesk gnome didnt worked correctly what should i do?

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre> for code samples. Still have questions? Post it on our forum