How to download a file from sourceforge with command line

I often need to download a file from sourceforge to a server or some remote system via command line but I can never remember how. I decided to write it down so I don’t have to keep sifting through AskUbuntu when I need to.

All you need to do is use wget, paste in the link you get from clicking the download button and specify the file name with -O.

So if I wanted to download ClamAV (found here) I’d click on the download link, get the url and filename and paste them in like so.

wget "http://sourceforge.net/projects/clamav/files/latest/download" -O clamav-0.98.tar.gz

That’s all there is to it!

Advertisements
How to download a file from sourceforge with command line

4 thoughts on “How to download a file from sourceforge with command line

    1. You know, I really have no idea. For one, the source code would have to be compiled and hosted on source-forge. In the event that it is, I don’t know how to specify that. Feel free to let me know if you figure it out.

    2. When the program you want to download is multiplatform, the web will offer you the OS version your computer use based on your browser’s UserAgent string so, you can force to download the desired platform (Linux/Mac/Windows… 32/64bit) using a different UserAgent with wget. For example:

      wget –header=”User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:47.0) Gecko/20100101 Firefox/47.0″ “http://sourceforge.net/projects/clamav/files/latest/download” -O clamav-0.98.exe

      should bring you the 32Bit of the .exe file (if exist;not tested yet since I’m not using clamav). If you intended to download the 64Bit version, then use “Mozilla/5.0 (Windows NT 6.1; WOW64; rv:47.0) Gecko/20100101 Firefox/47.0” instead (again; not tested since I don’t know if clamav have 32/64 versions).

      Try changing your UserAgent (I use this extension in Firefox: https://addons.mozilla.org/en-US/firefox/addon/user-agent-switcher-firefox/), visit the Mozilla Firefox downloads web (https://www.mozilla.org/en-US/firefox/new/) and you’ll see the trick.

      You have more info about the UserAgent here:
      https://developer.mozilla.org/en-US/docs/Web/HTTP/Gecko_user_agent_string_reference

      Finally, you can find some UserAgent strings list, like this:
      http://www.useragentstring.com/pages/useragentstring.php

      Hope that helps to understand the use of UserAgent string in wget…
      Benny.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s