wget - Downloading from the command line

Written by
Date: 2007-10-30 10:36:30 00:00
Tips and Tricks of wget

When you ever need to download a pdf, jpg, png or any other type of picture or file from the web, you can just right-click on the link and choose to save it on your hard disk. This is possible for one or even up to five files, but more than that.

wget is a GNU program, which is used a lot in Linux, it can download pages, and files from the internet directly to your computer.

If you do not have it installed you can install on:

Debian or Ubuntu

sudo apt-get install wget

wget tips

Download a single file

wget http://www.site.com/file.pdf

Download the whole site recursively

wget -r http://www.site.com

Download all files of a specific type: (pdf and jpg for example)

wget -r -A pdf,jpg http://www.site.com

Follow external links

wget -r -H -A pdf,jpg http://www.site.com

Follow external links only to specific server

wget -r -H -A pdf,jpg -D files.site.com http://www.site.com

Limit the levels you will dig when in recursive mode (default is 5)

wget -r -l 2 http://www.site.com

Limit the bandwidth used by wget (to 20KB/s in this case)

wget --limit-rate=20k http://www.site.com

As you can see, wget is very useful and flexible, use it at your wish.