Open Duplicate Chrome Tabs with Bash

As I was writing the TabIt post last week, I thought about including an option to duplicate a specific tab. It was a fleeting thought as I told myself “Nah, when would anyone ever need to open a bunch of the same tab?”.dupetab

As you would expect, literally the very next day I ran into a situation where I needed to open a bunch of duplicate tabs. In my case, we use Workday at Rackspace as our ERP. I was reviewing goals for ~100 folks, and didn’t want to go through “Click > Load Time > Click > Load Time > Read > Back > Back > Load Time” for every single one. While I’m a big fan of Workday, they have some weird javascript in their web application that prevents the normal shortcut to open a link in a new tab (CMD + Click) from working.

I decided the fastest way to do this was going to be to open a bunch of the same tab that list the employees and then use one tab per employee so I didn’t have to spend so much time waiting for Workday to load each page.

I tweaked TabIt to become DupeTab. The source is at: https://github.com/joshprewitt/tabit/blob/master/dupetab

Just like with TabIt, paste the source into a file in your path (or /usr/local/bin if you don’t know what that means), then make it executable

Once it is executable and in your path, you can call it just like any other command. If you run dupetab without any arguments, it will show the following help documentation:

Help documentation for dupetab
Basic usage: dupetab [options] <URL to replicate>
Options:
-n <count of tabs to open. Default is 5>
-s <Sleep between tabs. Default is 0.>
-c — Use Current Window.

If the URL has any special characters in it, you might want to wrap it in single quotes. The options are pretty self explanatory: -n will determine how many duplicates of the tab to open, and -c will have the tabs open in your current window instead of opening a new window just for the duplicates. With Workday, I ran into an error of too many concurrent connections, so I added in the -s option to specify a sleep time between tabs.

Here is is all together. Say you needed to open 12 tabs of http://google.com with a 2 second delay between opening each tab:

Keyboard Shortcuts

Just like with TabIt, don’t forget your keyboard shortcuts when working with a bunch of tabs

Shortcut Keys Action
Cmd+Shift+{ Go to Left Tab
Cmd+Shift+} Go to Right Tab
Cmd+w Close Tab
Cmd+Shift+T Re-Open Most Recently Closed Tab
Click a tab + Shift + Click a different tab Select Range of Tabs (Cmd+w will close all selected tabs)

Gotchas

This assumes a standard installation of Chrome. If you installed Chrome to a different location, you will need to change lines 64 and 70.

References

Artwork: New Window by Marek Polakovic from the Noun Project

Leave a Comment

NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">