Shell and Environment

exit

Exits a shell or script.

exit ends the current shell session or script and can return an exit status to the parent process.

Syntax
exit [status]

Arguments explained

  • Options adjust output or behavior.
  • Arguments name the files, services, hosts, or values the command should work with.

Common examples

Exit the current shell
exit

Closes the current shell session.

Exit with failure in a script
exit 1

Ends a script with a nonzero status.

exit Command
FieldDetails
Commandexit
CategoryShell and Environment
Primary useExits a shell or script.
Syntaxexit [status]