How to open a page in Chrome from the command line, in a new tab or an existing tab as appropriate?

Posted by MattH on Super User See other posts from Super User or by MattH
Published on 2010-03-12T06:48:29Z Indexed on 2010/03/12 6:57 UTC
Read the original article Hit count: 316

Filed under:
|
|

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 http://godzillahaiku.tumblr.com" 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.

© Super User or respective owner

Related posts about google-chrome

Related posts about command-line