Cmdline URL shortener & expander

terminalMost URL shortener services expose their APIs to use in your projects. I was looking for something similar to use from the cmdline for sharing links. There are some solutions using Google’s service which are not working. However, I found the API to be working. So here’s your cute cmdline URL shortener and expander.

    echo `wget -qO-\&format=simple\&url=$1`

    echo `wget -qO-\&format=simple\&shorturl=$1`

Add the above snippet to your ~/.bashrc to use.


$ tny
$ untny

Note that the following also work:

$ tny
$ tny
$ tny

However, http:// is required for untny().

2 thoughts on “Cmdline URL shortener & expander”


Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s