Downloading Files From Command Line Using wget

wget is a really useful tool for many reasons but it also makes an excellent download manager. It has many configuration options and can even be used to download many files from sites that require you to login such as rapidshare or hotfile.First you must install wget on your machine, I won’t go into details about how to do this as there is many resources available online with this information. If you are on linux or unix you will be able to use the package manager to install it easily, if you are on mac osx use MacPorts.

If the files you wish to download are freely available over http, simply put them in the text file separated by a newline and run this command:

This will download the files stored in your files.txt file one at a time and log results to log.txt. In this case both files would be placed in your home directory, you can change this to whatever you want. You can also add –limit-rate=20k to limit the download speed if you wish.

The problem with this command is that the terminal window must remain open for the download to continue and complete. This is not always desirable so you should run this using nohup, which means the process will continue even after the user has logged out.

This is really useful if you are downloading on a remote server etc.

If you want to cancel this download you will need to find it’s process ID and kill it, here is a simple way to do that. Run:

Find the ID of the wget process and then run:

where ID is the process ID. wget also has support for ftp downloading and cancel/resume, check the wget manual for more information.

If you want to download files like this from file hosting sites like rapidshare, the process is a little more tricky. First get the cookie exporter plugin for firefox. There are other ways to get your cookies but this is the easiest.

Clear your cookies and then login to rapidshare/hotfile etc, then go to tools > export cookies in firefox. This will create a cookies.txt file containing your current cookies.

Then simply put the files you wish to download in files.txt and run this new command instead:

This will download files from a file hosting site on autopilot, one at a time. If you are using rapidshare, you should turn automatic server selection on, so that as soon as you visit a rapidshare link when logged in, a download is served up.

, , ,

One thought on “Downloading Files From Command Line Using wget

Leave a Reply

Your email address will not be published. Required fields are marked *