Is there a terminal command that will log you out of your current desktop session and take you back to the login screen?
|
|
11.10 and above
11.04 and previous versions
(via or alternatively, you can use
Yes, there is a command called logout, but it concerns the Terminal. gnome-session-save is the program that actually quits the Notice as well that these commands don't require you to be root. You can always add an alias to your system if you want to have a shorter command. Open
(.bashrc is a script that is run every time a new virtual terminal is started up, you should set up all your permanent aliases there, see also: How to create a permanent "alias"?) |
|||||||||||||||||||||
|
|
I found this accidentally.
Here you get the process id of your current session. So, easy. Kill it
There you go. |
|||
|
|
|
In case you don't want to kill your session, you can go back to the login screen using:
If you select your user and enter your password, the session will be resumed, so it's not a full logout. |
|||
|
|
|
There is a way which will work whether you are running X or you are in a TTY. There you go:
The downside of this command is that it will ask for your password. |
||||
|
|
|
For Ubuntu Mate use |
||||
|
|
|
I tried Note: I use ubuntu 15.04 |
||||
|
|
|
Define a function by adding the following line to your .bashrc, then invoke by typing logoff at the shell prompt.
|
|||||||||||||
|
11.10 and aboveHere's my personal solution! In the terminal, run:
And add:
to the file! Now you just have to run log-out! |
||||
|
|
|
You can use below command:
|
|||||||||
|
|
lubuntu 12.10 LXDE running on a Samsung netbook (CPU: 1.66 GHZ Intel Atom; RAM: 2GB) The below two commands logged me out immediately:
|
|||||
|
|
On Xubuntu (or whenever using an Xfce session), you can logout via the terminal by using
You must specify In addition, another option will log you out as well:
If this command is issued the session is not saved, so it is normally best to use The ability to logout using the terminal will be very useful to you, as will the other options such as suspend that are available with For more information, see |
|||||
|
|
And in kubuntu 12.04+ it is:
|
|||
|
|
|
I had installed mate desktop and none of the menus worked, even the f-keys didn't work. I managed to get xterm through browsing with file manager. The only thing that worked was :
|
|||||||||||||||||
|
|
For gnome sessions,
Since the OP didn't specify the window/desktop manager, and the gnome-session-quit might not work with all possibilities, here's a generic X-windows way to return to the login screen or chooser which I've used several times over the last several releases: From a terminal (invoked with, variously, 'Alt-F2 + xterm, or Ctrl-T, or Crt-Alt-F1, or by right-clicking on the desktop in Nautilus and using the "open in terminal" shortcut, etc.) type
This is generally overkill for most situations. I tend to use it when I've got a hung process or when I've got to log out quickly. When I've done this, Ubuntu has politely returned me to the login screen by re-spawning X-windows. I've not yet used the |
|||
|
|
|
Looks like http://mail.gnome.org/archives/desktop-devel-list/2011-February/msg00147.html |
||||
|
|
protected by heemayl Oct 26 '15 at 21:22
Thank you for your interest in this question.
Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).
Would you like to answer one of these unanswered questions instead?
DoR