I am using iTerm2, but I wouldn't mind switching back to the original terminal for just this feature.

I open hundreds of SSH tabs every day and often end up working after a while only working on 1 terminal and other SSH tabs don't really matter anymore. In the browser at least you have "closer other tabs", "close left tabs", "close right tabs".

Is there any way to have a "close other tabs" in a Mac OS X terminal?

  • Is this question the right way round? On my machine standard terminal has Close Other Tabs, while iTerm2 does not. Which version of OS X are you running? – Paul Gilfedder Jul 24 '14 at 14:58
  • Which OSX version do You have? On my Terminal there's a function "Close other tabs" when I right click on the tab. – Mateusz Szlosek Jul 24 '14 at 14:58
  • There's even a shortcut for this: ⌘⌥W – Mateusz Szlosek Jul 24 '14 at 14:59
  • Ahh right! My standard terminal has the feature, iTerm2 unfortunately does not, right! I run Mac OS X 10.9.4. – ujjain Jul 24 '14 at 15:01

As a work around, you can drag the tab you want to keep to a different window, then close the first window with the extraneous tabs and they are all gone with one click.

| improve this answer | |

As is mentioned in the question comments, this is not possible in iTerm 2. It is possible in the built-in Terminal.app, but that was not the question.

While this isn't an optimal solution, a script has been written to implement this in iTerm. I did not write the script nor have I tested it, so I cannot verify the effectiveness of this solution. You may be able to bind a different keyboard shortcut to this script to satisfy your requirements.

iTerm issue report and script source.

| improve this answer | |
  • I tried it and unfortunately it didn't work. – ujjain Jul 25 '14 at 7:16
  • Well, I tried! I'll keep looking, but it appears that the iTerm development team needs to add this functionality in. – aglasser Jul 25 '14 at 13:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .