Decrypt shortened URL, the minimal way
Sometimes, you want to see which URL is behind a shortened link, without visiting the site.
If so, you might simply use a HEAD request with curl (http://mcbx.de/2b is the example URL):
$ curl -s -I http://mcbx.de/2b | grep '^Location' | cut -d" " -f2
https://coderwall.com/maltebublitz
Or, using awk instead of grep and cut:
$ curl -s -I http://mcbx.de/2b | awk '/^Location/ { print $2 }'
Written by Malte Bublitz
Related protips
1 Response
Leverage your curl
-fu better!
curl -sIw '%{redirect_url}\n' http://bit.ly/XyProblem | tail -1
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Shell
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#