Intro To 'logout' Command In Linux
2024-11-13 - By Robert Elder
I use the 'logout' command to log out from a login shell:
logout
Return To Login Prompt
I can use the 'logout' command to log out from the shell on the Linux command prompt:
logout

When I run the 'logout' command from a login shell, I'll be prompted to provide my credentials again before I can regain access to a command prompt:

Login Shells Vs. Non-Login Shells
If I run the 'logout' command from a graphical shell, I'll see an error message:

According to the bash shell documentation:
man bash
...
INVOCATION
A login shell is one whose first character of argument zero is a -, or one started with the --login option.
...
Here is the value of argument zero in a raw tty environment:

Here is the value of argument zero in a desktop terminal window, followed by the value when logged into a remote machine over SSH:

And that's why the 'logout' command is my favourite Linux command.
![]() A Surprisingly Common Mistake Involving Wildcards & The Find Command
Published 2020-01-21 |
![]() $1.00 CAD |
![]() A Guide to Recording 660FPS Video On A $6 Raspberry Pi Camera
Published 2019-08-01 |
![]() The Most Confusing Grep Mistakes I've Ever Made
Published 2020-11-02 |
![]() Use The 'tail' Command To Monitor Everything
Published 2021-04-08 |
![]() An Overview of How to Do Everything with Raspberry Pi Cameras
Published 2019-05-28 |
![]() An Introduction To Data Science On The Linux Command Line
Published 2019-10-16 |
![]() Using A Piece Of Paper As A Display Terminal - ed Vs. vim
Published 2020-10-05 |
Join My Mailing List Privacy Policy |
Why Bother Subscribing?
|