In Chrome we can close all the tabs in a window while keeping a selected one open.
Is there a keyboard shortcut to "close other tabs"?
There is no keyboard shortcut I know of and after checking Google forums, neither does anyone else.
You could use the extension Close Inactive Tabs instead - This adds a button which closes all other tabs except the active one.
I wrote this extension so that we can assign shortcuts for closing tabs to the right / left / other tabs / pin / unpin tab. Let me know if you can use it.
Update: It's temporarily off from Chrome Store and I'm working to get it back.Meanwhile, you can install it from here: https://github.com/diophung/close-chrome-tabs
The shortcut key to close all other tabs is CtrlShiftAltW if you install Amazing Tab Shortcuts, freely available in the Chrome Web Store.
I use it frequently for scripts, which I suspect is your use.
Here is an extension that assigns a keyboard shortcut to close other tabs. .
Works great on my Mac with Chrome stable channel.
None of them work. The easiest way is to right-click on the tab that you want to keep open and then click 'close other tabs'. The shortcut to close ALL tabs is Ctrl+Shift+W, to open a new tab is Ctrl+T, and to close the tab you are on is Ctrl+W. Also, if you close a tab by mistake and want to reopen it to the same page it was on, use Ctrl+Shift+T. Experiment with the rest like, Ctrl+Shift+E, etc.
In OS X you can create ~/Library/Scripts/Applications/Google Chrome/
and save this script there with Script Editor:
tell window 1 of app "google chrome" to close tabs whose id is not (get id of active tab)
Then use FastScripts to give the script a shortcut.
Using Vimium, you can use Ctrl+X
to close other tabs (add map <c-x> closeOtherTabs
to Vimium -> Options -> Custom key mappings) and Shift+X
to restore the last closed tab.
Shift+F10
, most full-keyboards have a dedicated button for opening a context menu (usually somewhere between Ctrl
and Alt
.
Jun 30, 2023 at 19:49
this script is definitely working :
osascript -e 'tell application "Google Chrome"
set activeTabId to id of active tab of front window
repeat with tabIndex from (count of tabs of front window) to 1 by -1
set aTab to tab tabIndex of front window
if id of aTab is not equal to activeTabId then
close aTab
end if
end repeat
end tell
I use Afred (on Mac) to activate it.
On Mac you can add a keyboard shortcut to any menu item.
This still works on Ventura, but the location has moved. [Use search in Settings]