Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I installed various window managers (Awesome, dwm, etc.) from which I am not able to log out back to the login screen (gnome-session) in order to switch to another window manager. I need to reboot to do that, which is a waste of time.

Question How can you log out via the terminal? didn't work..

dbus-send --session --type=method_call --print-reply --dest=org.gnome.SessionManager /org/gnome/SessionManager org.gnome.SessionManager.Logout uint32:1

..neither did this:

gnome-session-save --force-logout

..nor that:

gnome-session-quit --force-logout

they all returned:

Failed to call logout: The name org.gnome.SessionManager was not provided by any .service files

Is there a quick way to log out back into Gnome's session manager from a non-Gnome desktop manager using a terminal emulator? I know that CTRL+ALT+BACKSPACE can be configured to restart X, but I'm looking for the easiest way to log out.

share|improve this question
1  
Could you not just log out by just quitting the WM - i.e Mod4+Shift+Q for awesome? –  Alexander Torstling Apr 19 '12 at 17:28
add comment

3 Answers

up vote 8 down vote accepted

You could restart the desktop manager, which is similar to restarting X.

On Ubuntu 11.10:

sudo service lightdm restart

On earlier versions:

sudo service gdm restart

If that fails or you are on a very old system, try:

sudo /etc/init.d/gdm restart

One of these should take you back to the login screen. Be aware that you will not be prompted, so save any work before running this command!

share|improve this answer
2  
This kills all connected users. Not always what you want. –  cadrian Sep 18 '13 at 6:47
add comment

<modkey> + shift + q is the default dwm command for killing the dwm client. This effectively returns to the logout screen. Tested on a MacBook Air XUbuntu 12.10, where it is alt + shift + q.

share|improve this answer
    
To switch users leaving the session open, one can use dm-tool switch-to-greeter or Ctrl + Alt + F{7,8}. Tested on Xubuntu 13.04 + i3. –  ignis Oct 4 '13 at 7:37
add comment

On Ubuntu 12.04 you can use

/usr/lib/indicator-session/gtk-logout-helper --logout

It opens a dialog box. I use it with Awesome Window Manager.

To directly logout, you can also (softly) kill your window manager.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.