Now that Google has released an API for its goo.gl URL shortening service, command line geeks have a couple of options to create short URLs without opening a browser.

google_url_shortener

Developed by Josh Nesbitt at Stac, google_url_shortener is a handy command line utility to create and expand goo.gl URLs.

Install via Rubygems

gem install google_url_shortener

… and configure your API key

googl install supercalifragilisticexpialidocious

Now you can shorten URLS with

$ googl shorten http://thechangelog.com                                         
--> http://goo.gl/qWxv

The built-in help shows the full usage:

~ ยป googl --help                                                                 
Google URL Shortener

Examples:

  googl install myapikey
  googl {shorten,s} http://example.com
  googl {expand,e} http://goo.gl/1234
  googl expand http://goo.gl/1234 -a

Options:
  --analytics, -a:   Show analytics when expanding a URL
    --version, -v:   Print version and exit
       --help, -h:   Show this message

Be sure and check out the Stac blog post for tips on setting up copy-to-the-clipboard Bash aliases and such.

Get Shortly

If, like us here at The Changelog, your needs for URL shortening go beyond goo.gl, you might check out Shortly from Bagwan Pankaj. In addition to goo.gl, Shortly also supports bit.ly, is.gd, and tinyurl.com.

If someone wanted to beat me to it and fork the project to add ShortSwitch support for our lg.gd domain, you just might get some ink on this here blog…

[google_url_shortener on GitHub] [shortly on GitHub]


Have comments? Send a tweet to @TheChangelog on Twitter.

Subscribe to The Changelog Weekly – our weekly email covering everything that hits our open source radar.