Command-line URL shortener

Command-line tool to shorten URLs using the excellent v.gd URL shortener.

This tool is free software under the GNU Affero General Public License, version 3.

Assuming GNU/Linux with the apt-get command installed and working, GNU Bash as your shell, and installation rights available using sudo, you can install vgd as follows:

sudo apt-get install curl gridsite-clients
mkdir -p ~/bin
curl 'https://gitlab.com/sampablokuper/vgd/raw/master/vgd' > ~/bin/vgd
chmod +x ~/bin/vgd
echo -e '\n# Add ~/bin to PATH\nexport PATH="$HOME/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc

You can now run vgd by entering vgd followed by the URL you want to shorten. Put the URL in single quotes. The tool will return a shortened URL. For example:

$ vgd 'example.com'

An example using a longer URL:

$ vgd 'https://tools.wmflabs.org/geohack/geohack.php?pagename=Highsett&params=52.196_N_0.131_E_'

N.B. This tool uses the v.gd API, and is therefore subject to that API's restrictions/limitations.