Super User is a question and answer site for computer enthusiasts and power users. 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 looking for a way to open a given page in Google Chrome from the command line, with the following behaviour:

  • If the given page is already open in a tab, navigate to that tab
  • If the given page is not already open in a tab, open the page in a new tab and show that tab

Currently when I open a URL from the command line (e.g. using "open" on Mac OS X), Chrome will always open the URL in a new tab. I end up with lots of duplicate tabs as a result, which is a minor annoyance.

I'm looking for a solution that works on Mac OS X, but a non-OS specific solution would be preferable.

I'd consider writing a Chrome extension for this if there's no existing solution.

share|improve this question

This is a simpler command line, but will still open a new tab:

open -a Google\ Chrome <file> 
share|improve this answer
I get the error '....\open' is not recognized as an internal or external command, – Myster Feb 4 '15 at 1:30
This works for me on Mac OSX. Are you using a different OS? – Luis B Feb 10 at 23:12

Turns out this can be done with a few lines of javascript in a Chrome extension.

Still open to other answers, but in the meantime I've written a Chrome extension to do this and put the source online.

share|improve this answer
Care to enlighten me what the downvote was for with some constructive criticism? – MattH Mar 13 '10 at 11:25
this little extension you made is in the pocket, thanks – aaron May 29 '11 at 3:27

You must log in to answer this question.

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