There’re many desktop environments that work on Ubuntu system. Sometimes panel may disappear or error load after configuration error. This tutorial will show you how to log out Unity, Gnome Shell, KDE, Xfce desktop via command in terminal from Ubuntu 12.04 Precise.

  • For Unity, gnome-shell and gnome-classic, run this command:

    You’ll see this old gnome log-out dialog with 60 seconds timeout.

  • For Xubuntu, Xfce desktop, run this command:

    It launches normal shutdown/reboot/logout dialog.

  • For Kubuntu, KDE4 desktop, I found this command (without test):

    qdbus org.kde.ksmserver /KSMServer org.kde.KSMServerInterface.logout -1 -1 -1