LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Ubuntu (https://www.linuxquestions.org/questions/ubuntu-63/)
-   -   How do I log out via terminal? (https://www.linuxquestions.org/questions/ubuntu-63/how-do-i-log-out-via-terminal-928183/)

LAPIII 02-07-2012 04:33 PM

How do I log out via terminal?
 
I know how to sudo reboot & sudo shutdown -h now, but not logout!

klearview 02-07-2012 05:05 PM

exit

LAPIII 02-07-2012 05:16 PM

I meant logout & go to the login screen.

klearview 02-07-2012 05:25 PM

Quote:

Originally Posted by Advice Pro (Post 4596476)
I meant logout & go to the login screen.

If you enter 'exit' in the terminal, you go to the login screen. If you meant terminal emulator or SSH connection - that's a different matter.

LAPIII 02-07-2012 05:38 PM

I guess exit just won't work in 11.10 with these configurations:


Code:

sudo apt-get install gnome-session-fallback

sudo add-apt-repository ppa:jconti/gnome3

sudo apt-get update

sudo apt-get install indicator-applet indicator-applet-complete indicator-applet-session


kmkswamy 02-08-2012 10:51 PM

or just use Ctrl+d to logout.:)

widget 02-09-2012 12:29 AM

Ctrl+d takes you out of your terminal.

exit certainly does not work for me either. Hardly ever log out but thought I would give it a whack.

I use Debian testing so I don't think there should be much difference in terminal commands like this. I use plain halt in my root terminal to shut down.

spezticle 04-25-2012 09:36 AM

Code:

gnome-session-save --logout
or
Code:

gnome-session-save --force-logout
or
Code:

gnome-session-save --help

lampion 05-24-2012 03:14 AM

Actually for me on Ubuntu precise (12.04) :
Code:

/usr/bin/gnome-session-quit --no-prompt
work

mrSquiggle 03-27-2013 05:59 PM

Quote:

Originally Posted by klearview (Post 4596470)
exit

Thanks klearview, "exit" worked perfectly for me. Command line in server is all new to me so am all at sea as yet with what and how I'm doing things in 12.04
Cheers

andrew.comly 05-06-2013 05:08 AM

exit doesn't log one out
 
Quote:

Originally Posted by klearview (Post 4596470)
exit

entering "exit" in the terminal will close terminal. This certainly has nothing to do with logging out.

andrew.comly 05-06-2013 05:11 AM

Doesn't work in Lubuntu
 
Quote:

Originally Posted by lampion (Post 4686163)
Actually for me on Ubuntu precise (12.04) :
Code:

/usr/bin/gnome-session-quit --no-prompt
work

This doesn't work in Lubuntu's LX terminal, when I enter "/usr/bin/gnome-session-quit --no-prompt" in the terminal I only get back a "** (gnome-session-quit:13804): WARNING **: Failed to call logout: The name org.gnome.SessionManager was not provided by any .service files".

TobiSGD 05-06-2013 05:12 AM

Quote:

Originally Posted by andrew.comly (Post 4945815)
entering "exit" in the terminal will close terminal. This certainly has nothing to do with logging out.

Actually, it has. If you log in on a virtual terminal (not a terminal emulator) or connect via SSH or Telnet to a machine the exit command will log you out.

andrew.comly 05-06-2013 05:19 AM

Warning: Non functional advice
 
Quote:

Originally Posted by spezticle (Post 4662753)
Code:

gnome-session-save --logout
or
Code:

gnome-session-save --force-logout
or
Code:

gnome-session-save --help

This advice yields:
a@SAM:~$ gnome-session-save --logout
gnome-session-save: command not found
a@SAM:~$ gnome-session-save --force-logout
gnome-session-save: command not found
a@SAM:~$ gnome-session-save --help
gnome-session-save: command not found
I even tried to install the "gnome" command above, only to encounter:
a@SAM:~$ sudo apt-get install gnome-session-save
Password:
正在讀取套件清單... 完成
正在了解依存關係
Currently reading status info... Completed
E: Can't find gnome-session-save package location

andrew.comly 05-06-2013 05:37 AM

Lubuntu: Solution
 
Below are some commands that ended up working on my Lubuntu 12.10 (LXDE,non virtual boot):
sudo pkill -u username
sudo service lightdm restart

Worked beautifully!!


All times are GMT -5. The time now is 12:15 PM.