Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This question already has an answer here:

I have seen some previous post about logout from terminal but those were for old versions. I didnt find the way for logout in Ubuntu 13.10 from terminal.

How can I logout from terminal in Ubuntu 13.10 ?

share|improve this question

marked as duplicate by Oli Nov 20 '13 at 10:24

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

Typing exit doesn't work? – To Do Nov 20 '13 at 9:12
Ctrl-D? (Feel like I'm missing something in this question...) – Ash Nov 20 '13 at 9:17
3… don't work? – Takkat Nov 20 '13 at 9:32
"... and above" should include all releases greater than 11.10 (12.04, 12.10, 13.04, 13.10, 14.04 ...) - if any of these procedures stopped working we'd urgently need to edit the answers there to say so. – Takkat Nov 20 '13 at 9:56
If you've seen a previous post and you've tested it, make sure you a link to it and show us what didn't work. – Oli Nov 20 '13 at 10:26

gnome-session-quit --no-prompt will log you out of an existing Unity session, without a prompt.

share|improve this answer

I usually do a killall -u <your-user-name> to stop my current session and clean-up any remaining processes of mine.

share|improve this answer
cant to do this , because its not safe. – Raja Nov 20 '13 at 9:31
what is not safe about it? – MadMike Nov 20 '13 at 9:32
killall -u <username> will only kill the <user-name> processes (ie. no root-processes will be harmed). Additionally I don't say to kill it with -9. Your link doesn't relate to my answer at all. – MadMike Nov 20 '13 at 9:55
@rajagenupula still not convinced yet? Please explain some more what is wrong with my answer. – MadMike Nov 22 '13 at 12:37

If you are in a gnome / unity environment, you could use the gnome-session-quit command, you could use gnome-session-quit --no-prompt if you don't want to choose between lock or logout.

If you are in a pure terminal (no X-environment) exit should do the trick

share|improve this answer

You can use dbus signal to logout from the desktop, with dbus-send:

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

Tested with gnome and unity.

share|improve this answer

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