How do I remotely fetch files from redirected URLs from a terminal?
Use curl
instead – and if you know it's a tar archive, you can just pipe the output into tar
to extract it automatically.
curl -L https://github.com/simplegeo/python-oauth2/tarball/master | tar xz
If you just want to save the file, use the -o
option with your own name, or try -O
, which will use the remote file name automatically (but might not always work).
From man curl
:
-L
: If the server reports that the requested page has moved to a different location (indicated with a Location: header and a 3XX response code), this option will make curl redo the request on the new place