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 man wget but the got lost in there, and didn't find an option to follow redirects.

  • 1
    you mean man wget? – dovah Aug 23 '16 at 15:20

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'
  • 1
    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
  • 2
    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
  • 1
    this does not work anymore: executing your command ends up with a download?use_mirror=vorboss.html file. What is the solution now? – David Portabella Nov 1 '16 at 10:20
  • 1
    You have a %22 (") at the end of the URL. I had no problems with wget 'http://downloads.sourceforge.net/project/romfs/genromfs/0.5.2/genromfs-0.5.2.tar.gz' – Matteo Feb 15 '17 at 10:05

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.

  • 2
    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
  • 1
    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
  • 1
    Works in Firefox as well. – user5359531 Feb 14 '18 at 4:58
  • Why "chrome browser"? BTW, this is not convenient for using in a command line environment. Normally, people who use wget are not in a graphical environment. – cedbeu Oct 6 '18 at 22:03

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.

  • Doesn't wget automatically follow redirects for you? – Dmitry Grigoryev Nov 17 '15 at 15:11
  • 1
    @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
  • 1
    Thanks, your post solved my annoying problem. In current sourceforge download page, "direct link" is show if you click the "Problems Downloading?" button. – user802708 Nov 27 '18 at 3:34

protected by Michael Mrozek Jan 18 '16 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 (the association bonus does not count).

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.