How to close a GNOME terminal tab from the keyboard?

When the shell process inside the terminal tab exits, it will close. If it was the only tab, the entire window will close. So you just have to quit the Bash session.

Your Bash session quits...

  • when you type the command exit.
  • when you press Ctrl+D to send an EOT ("End Of Transmission") code.
    Note that it must be pressed when the command prompt is empty, i.e. you haven't typed anything else on that line yet.

Please also note that you can nest multiple interactive shells. You can start a new shell inside the current one by running e.g. bash, sh, python, bc, ... The exit and Ctrl+D will always only terminate the currently active shell, which is usually the innermost one.


From the GNOME Terminal help:

  • Close Tab: ShiftCtrlW
  • Close Window: ShiftCtrlQ

You already mentioned it, type exit and the tab (as well as the terminal session running within the tab) will be closed.


Like @YiboYang mentioned in comments, it is not possible to do Ctrl + W or exit in some cases:

A keyboard shortcut could actually be useful if you're trying to close a tab with a frozen unresponsive ssh session.

That shorcut can be viewed/changed from the Menu bar, via File>Terminal>Preferences>Shortcuts

GNOME terminal preferences

It is highlighted in the image above. Double-click on the Shortcut key and simple key-in a new combination to assign to it,

E.g. I have set mine as Ctrl + W to be synchronous with the standard browser shortcut to close a tab.