Download Ninja

By Community Team

Update: we’ve found that different builds (same version) of wget behave differently. For example, Mac OS X (GNU Wget 1.12 built on darwin9.8.0) will save the file with the correct name while Ubuntu (GNU Wget 1.12 built on linux-gnu) saves the file as “download”. The workaround is to use the -O option to specify the file name. The instructions below have been updated to include that option.

Command line gurus out there are likely familiar with the tools wget and curl, both useful for requesting URLs from the command line. What may be less clear is how to use curl and wget to download files from SourceForge. Strap in and hang on because you’re about to become a download ninja.

Let the Training Begin

We’re going to use wget but the same principles also apply to curl; just be sure to add the -L option to follow the redirect to our mirrors and the -o <file> option to specify the file name. A typical wget command looks like this:


$ wget -O myfile.zip http://example.com/myfile.zip

Pretty simple, eh?

All a download ninja needs is the URL of the SourceForge download. Here’s where we separate the senpai from the kōhai: download ninjas know the same URL can be used with wget. For example, our ninja needs to download phpPgAdmin, a web-based administration tool for PostgreSQL databases. The ninja clicks on phpPgAdmin’s GDB (Green Download Button) and ends up at the following URL:

http://sourceforge.net/projects/phppgadmin/files/phpPgAdmin%20%5Bstable%5D/phpPgAdmin-5.0/phpPgAdmin-5.0.2.tar.gz/download

And… Fight!

Reacting with deadly grace, the ninja copies and pastes that URL into the command line (>> indicates line wrap):


$ wget -O phpPgAdmin-5.0.2.tar.gz >>
http://sourceforge.net/projects/phppgadmin/files/>>
phpPgAdmin%20%5Bstable%5D/phpPgAdmin-5.0/>>
phpPgAdmin-5.0.2.tar.gz/download
...
Saving to: "phpPgAdmin-5.0.2.tar.gz"
100%[============================================================>] 1,063,554 694K/s in 1.5s
2011-02-18 00:17:40 (694 KB/s) - “phpPgAdmin-5.0.2.tar.gz” saved [1063554/1063554]

Masterfully slicing through the interwebs, the download ninja stealthily slips away with an awesome PostgreSQL tool. Pretty sweet, huh?

But wait! There’s more!

The goodness isn’t limited to just curl and wget: download/install tools like Python’s easy_install or an application’s auto-update utility can also use these URLs.

Bonus Round

We also have a special “latest/download” URL that’s a bit like Google’s “I’m Feeling Lucky” button for downloads:


$ wget >>
http://sourceforge.net/projects/phppgadmin/files/latest/download

If you use it we’ll try to send you the latest download. Wget (and similar tools) makes it a little tricky to figure out if you’re on Windows, a Mac, Linux, etc. If you’re downloading something that’s OS-specific you’re better off using the full URL. Furthermore, some builds of Wget aren’t quite as ninjariffic about figuring out the right filename for saving locally (see the update). On the other hand we might be able to save you a little typing and that should make any download ninja happy.

Comments are closed.