0

Google URL Shortener is a free online service that allows users to shorten long and unreadable URLs. If you are under Ubuntu and want to shorten your URLs via the Terminal, without using your web browser, then follow these simple instructions:

1. Launch the Terminal and issue this command to install first the curl command line tool:

sudo apt-get install curl

2. To shorten a URL via command line, run this command:

curl -s -d'&url=URL' http://goo.gl/api/url | sed -e 's/{"short_url":"//' -e 's/","added_to_history":false}/\n/'

Replace URL with the URL you want to shorten, here is an example:

curl -s -d'&url=http://www.upubuntu.com' http://goo.gl/api/url | sed -e 's/{"short_url":"//' -e 's/","added_to_history":false}/\n/'

The shortened URL will have this format:

http://goo.gl/sKzoh

This tip is also applicable on other Linux-based distros, but make sure that the curl command line tool is well installed.

That's it!

Post a Comment

 
Top