Take the 2-minute tour ×

How do you log out in the most recent version of Ubuntu from a local terminal?

share|improve this question

migrated from stackoverflow.com May 25 '10 at 20:02

This question came from our site for professional and enthusiast programmers.

Control + Alt + Backspace... Not sure this is a safe logout, but probably the quickest! –  William Hilsum May 25 '10 at 20:15
@Wil: Ctrl-Alt-Backspace is disabled in recent ubuntu builds. it was the traditional emergency-kill-X-windows, but it was implemented in the X server itself and has been removed. you can add it back as a standard keyboard shortcut if needed. but killing X-windows isn't exactly the same as logging out gently. :) –  quack quixote May 25 '10 at 21:34
@quack quixote, I didn't write as an answer because I know it isn't exactly good! I never said gently! Anyway, +1 very interesting, I am only on Ubuntu 8.04 and had no idea it is no longer used in recent builds. –  William Hilsum May 25 '10 at 21:42
@wil: i think it was first disabled in Jaunty (9.04); there was a package called dontzap you could install to re-enable (it was still an X-server option then). anyway see wiki.edubuntu.org/X/Config/DontZap for details. there's some further discussion of other emergency keyboard shortcuts at the bottom of the page. –  quack quixote May 25 '10 at 21:49

2 Answers 2

I use this:

gnome-session-save --logout-dialog
share|improve this answer
that's (certainly) the way to logout GNOME, not GDM (I use i3 as window manager, so it can't work!) –  Kevin Aug 16 '11 at 8:24

sudo /etc/init.d/gdm stop

or restart if you want to log in as a different user:

sudo /etc/init.d/gdm restart

share|improve this answer
This doesn't work as recent versions of Ubuntu use upstart instead of a SysV init script to start gdm. Use "sudo service gdm stop" instead. Like Control + Alt + Backspace this kills the X server (together with gdm). To just logout the current user Thomas Leonard's solution is usually better. –  Florian Diesch May 26 '10 at 14:06
Sorry, it works, but is deprecated (for some reason I can't edit mycomment above anymore) –  Florian Diesch May 26 '10 at 14:15

Your Answer


