Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Is there a command to close a terminal window via commandline?

share|improve this question

5 Answers 5

up vote 12 down vote accepted

To close a terminal window you can use the exit command . Alternatively you can use the shortcut ctrl+shift+w to close a terminal tab and ctrl+shift+q to close the entire terminal including all tabs.

share|improve this answer

You can use the ^D shortcut - that is, hitting Control and d. This works in many shells and shell-like environments. Technically speaking, this key combination emits the end-of-transmission character (ASCII code 04). In gnome-terminal, i.e. bash and other shells, this is interpreted as finishing the interactive session. You can also see this behavior in programs like cat which read from standard input (the keyboard). Try running it without arguments; you can terminate by entering ^D.

share|improve this answer
exit

is the command you want to use for that.

share|improve this answer

There is an alternate way, which requires a bit more keystrokes, but is worth knowing.

Using exec command

  • Syntax
exec <command-name>
  • This will first execute the <command-name> and then exit the shell.

  • For example, you could do:

exec sleep 1

          which would, effectively, close the window after 1 second.

share|improve this answer

Yes. The command is exit. Type exit into the terminal and press enter

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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