I can not terminate a user session through the terminal with the logout command. The message is displayed:

bash: logout: not a command shell login: use "exit"

The name of the current desktop environment [ echo $DESKTOP_SESSION ]: lightdm-xsession

The reboot , shutdown works.

The final response line for the cat /etc/lsb-release; arch; lightdm --version cat /etc/lsb-release; arch; lightdm --version cat /etc/lsb-release; arch; lightdm --version is: lightdm 1.18.3


I had to end the session in order to try to get rid of the sudden hang of the system. Initially, I rebooted linux, ctrl + alt + F1 and then drove a reboot into the terminal. But now I will use sudo service lightdm restart .

  • Well, use exit . - Beast Winterwolf
  • I think that exit and logout have slightly different semantics. - KoVadim
  • Note that exit will work if the command is executed directly from the shell, but in general it depends on the DE you are using. for example, for GNOME gnome-session-quit --force , for XFCE xfce4-session-logout . For others, I don’t know, google :) - Beast Winterwolf
  • it is not clear what exactly you want to achieve. Especially strange is the mention of the programs reboot and shutdown. - aleksandr barakin
  • one
    then you are completely looking for the wrong place: the bash interpreter’s internal logout command has nothing to do with the x-session you want to end. - aleksandr barakin

1 answer 1

The bash interpreter logout internal command has nothing to do with the x-session you want to end.

Help on the internal bash interpreter logout command:

 $ help logout logout: logout [n] Exit a login shell. Exits a login shell with exit status N. Returns an error if not executed in a login shell. 

This command terminates only the session executed with the login, i.e., when the bash interpreter is invoked with the -l option.


Demonstration:

 $ bash $ logout bash: logout: not login shell: use `exit' $ exit $ bash -l $ logout $ 
  • one
    that's right: you started another bash interpreter process (with the -l option), and then you completed it. // what does “terminal restart” mean? - aleksandr barakin