I often use reboot -n and shutdown -t now commands to restart and shutdown my system.

Is there something similar to log out of the current user account?

That is logout of my user session for the whole session. I'm using Ubuntu server with i3 so maybe I'm looking for an Ubuntu specific answer(?)

  • 1
    but what if you're running ksh or zsh or tcsh? (tongue-in-cheek) – Jeff Schaller Feb 16 '17 at 20:32
  • @jeffschaller :p maybe I should be, I don't know much about zsh but I seem to see it mentioned in a lot of places :-) – Philip Kirkbride Feb 16 '17 at 20:33
  • 1
    just (indirectly) pointing out that while bash is a common shell, it's not your Everything -- it has some built-in commands, but reboot and shutdown are not bash commands. – Jeff Schaller Feb 16 '17 at 20:34
  • @JeffSchaller interesting I didn't realize that. What exactly counts as standard bash is it the commands available on all posix systems? – Philip Kirkbride Feb 16 '17 at 20:36
  • 1
    see the manual in regards to "Shell Builtin Commands" – Jeff Schaller Feb 16 '17 at 20:38

logout is used by users to end their own session

  • 1
    I get back "bash: logout: not login shell: use `exit'" – Philip Kirkbride Feb 16 '17 at 20:38
  • 2
    exit will exit you from the shell you are in, logout will log you out if you are in a login shell – ProdIssue Feb 16 '17 at 20:46
  • I get the same error as @Phi - did you ever resolve this? – stevens Mar 20 '19 at 20:49

Assuming you have default shellopts i.e ignoreeof is false. On a blank line Ctrl+d will exit you out of login shells and ssh sessions.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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