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

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.


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.


exit

is the command you want to use for that.