LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

logout

exits a login shell

TLDR

Exit login shell
$ logout
copy
Exit the login shell with a specific status code
$ logout [1]
copy

SYNOPSIS

logout [status]

DESCRIPTION

logout exits a login shell. It terminates the current shell session and returns to the login prompt.The command is a shell builtin. It only works in login shells, not subshells or other non-login shells, where bash reports "not login shell" and suggests exit instead.When a bash login shell exits, it runs ~/.bash_logout if it exists (zsh runs ~/.zlogout). Pressing Ctrl+D on an empty prompt has the same effect unless ignoreeof is set.

PARAMETERS

STATUS

Exit status code (optional). Defaults to the status of the last command executed.

CAVEATS

Only works in login shells. Use exit for non-login shells. Shell builtin command.

HISTORY

logout is a shell builtin that originated in the C shell (csh) of BSD Unix and was adopted by bash, zsh and tcsh for terminating login sessions. It is not specified by POSIX, so plain sh implementations such as dash do not provide it.

SEE ALSO

exit(1), login(1), bash(1), zsh(1)

Copied to clipboard
Kai