Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm not talking about closing the terminal window itself which you can easily do by using the exit command. I'm talking about closing a tab that you have originally opened up by pressing the CtrlShiftT key combination. When I'm done working with it, I would like to close it down without lifting my hands up from the keyboard and going for the mouse to click that small X button. Is there a command for that?

enter image description here

share|improve this question
Just exit the shell (ctrl-d)? The other tab will remain open. – muru Mar 4 at 13:06
So, I can use either exit or Ctrl+D to close a tab. Thank you. – misha Mar 4 at 13:11
up vote 22 down vote accepted

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.

share|improve this answer
when you press ctrl-d ... on an otherwise empty prompt. – muru Mar 4 at 14:10
@muru Yes, that's correct. I'll add it. – Byte Commander Mar 4 at 14:13
another small addition: if you are inside more than 1 shell ... it will exit the shell and not close the tab. (ie. "bash" "bash" "bash" requires 4 control-d's for the tab to close) – Rinzwind Mar 4 at 15:10
@Rinzwind Ooohhhkay... I'll add that as well ;-) – Byte Commander Mar 4 at 15:21
Might be worth noting that Ctrl+u will clear the current line of the terminal so ctrl+u, ctrl+d will exit. – Holloway Mar 6 at 10:32

From the GNOME Terminal help:

  • Close Tab: ShiftCtrlW
  • Close Window: ShiftCtrlQ
share|improve this answer
Those are the defaults. See "Terminal" "preferences" "shortcuts" in case these do not work and "someone" changed them and forgot about the change. The other answers are ever so slightly flawed: exit or control-d only works on the 1st level (if you type "bash" you need 2 exits) and on an empty prompt. – Rinzwind Mar 4 at 15:08

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

share|improve this answer

Your Answer


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.