Back to the command reference

exit

ShellBeginner In simulator In real Linux

Leave the current shell

Name: exit

You can practise it right away in the simulator, and use it in real Linux mode too.

Description

exit is a shell builtin that ends the shell with an exit status (by default that of the last command). Interactively it closes the session or SSH login; in a script it ends the script.

Syntax

exit [N]

Common options

NExit status; 0 means success

Examples

  • $ exit

    Close the terminal or end an SSH session

    Explain
  • $ exit 1

    Exit a script with an error

    Explain

Related