
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