Skip to content

Instantly share code, notes, and snippets.

@kernelsmith
Last active April 5, 2017 21:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kernelsmith/c6c74f31f6c5dd97a6aa2bda881681aa to your computer and use it in GitHub Desktop.
Save kernelsmith/c6c74f31f6c5dd97a6aa2bda881681aa to your computer and use it in GitHub Desktop.
follow a redirect at the command line
curl -s -I $url | grep \^Location: | cut -d ':' -f 2-
# I had a longer version that continued following redirects up to a limit, but
# can't find it atm
# if you'd like to do the above anonymously, you can use https://hurl.it and
# change the HTTP method from GET to HEAD and paste in your URL (assuming HEAD
# is supported by the webserver). In the response you'll see the
# Location: HTTP header w/the redirected URL (assuming nominal situation).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment