Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This question explains how to do it with curl. The accepted answer also points out that

If wget is available, that would be far simpler.

I looked through mam wget but the got lost in there, and didn't find an option to follow redirects.

share|improve this question
up vote 14 down vote accepted

wget follows redirects automatically. Just give the URL as an argument

wget 'http://downloads.sourceforge.net/project/romfs/genromfs/0.5.2/genromfs-0.5.2.tar.gz'
share|improve this answer
    
Oh. I had given it the wrong url and wandering why it is not working. Thanks a lot. – Vorac Aug 16 '13 at 8:18
3  
Sourceforge URL's often need to be quoted due to the &'s in them as well (pre redirect) – Matt Aug 16 '13 at 15:46
1  
Note that when using wget with the SourceForge download URL, the wget output shows the Location: header containing the "real" URL to which the HTTP GET operation is redirected. Copy this URL for subsequent use with HTTP GET agents that cannot follow redirects. – Jonathan Ben-Avraham Dec 28 '15 at 16:38

Start the download in chrome browser. When it starts cancel it and go to downloads page. You can see the url for the download. Copy it and use it with wget.

share|improve this answer
    
This seems to be unnecessarily complicated.  Note that some systems don't have Chrome installed.  Is there any reason why your answer would be preferable over the two-year-old one? – G-Man Jun 2 '15 at 8:27
    
Aptly said about chrome. I was just trying to provide a simple trick that might be useful for other sites as well. – Prasanna Kumar Jun 2 '15 at 8:53

Click the link, you'll get redirected, and you'll see something like "Redirecting... if you are not automatically redirected, click the direct link.

Copy that [direct] link's location, paste it in the command-line like this

wget "http://downloads.sourceforge.net/project/lame/lame/3.99/lame-3.99.5.tar.gz"

That's it! It worked for me.

Edit: You should omit everything after the '?' character in the url, or else the filename will also have this part.

share|improve this answer
    
Doesn't wget automatically follow redirects for you? – Dmitry Grigoryev Nov 17 '15 at 15:11
    
@DmitryGrigoryev it would, if it were a proper 301/302 redirect. This is a landing page followed by a scripted redirect. – muru Nov 17 '15 at 15:17

protected by Michael Mrozek Jan 18 at 1:16

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site.

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.