- Simply downloading a file :
$ wget <URL>
Or better :$ wget -c <URL>
-c or --continue lets you resume your incomplete download done using wget or a different program - Downloading a file silently (a very imp. feature in wget, to work in background) :
$ wget -q <URL> &
- Taking a log of all messages :
$ wget <URL> -o filename
- Downloading files from a Queue :
$ wget -i filename
Strore all download links in a file separated by Return key and link it with wget - Set your no. of retries and timeout seconds :
$ wget -t <no. to tries> -T <duration> <URL>
- Displaying the content of a file rather than saving it on Hard Disk :
$ wget -O - <URL>
- Retrieving all file with a particular extension from a web directory :
$ wget -r -l1 -np -A.<extension> <directory>
Example for http://www.abc.com/def/*.jpg$ wget -r -l1 -np -A.jpg http://www.abd.com/def/
- Downloading an entire Web Site :
$ wget -c -r -nc -p -D <domain> -k <URL>
For this I have written a script for easy downloading :#!/bin/bash
Or download the script from here. Syntax :
# Bash Script for Web Site downloading by GNUger
# Syntax : $ sitesdwn [URL]
command="wget -c -r -p -k"
domain=$(echo $1 | cut -d/ -f3 | cut --complement -d. -f1)
echo
read -p "Download within $domain only (y/n) : " opinion
if [[ $opinion == 'y' ]] ; then
command="$command -D $domain"
fi
read -p "Disable overwriting existing files (y/n) : " opinion
if [[ $opinion == 'y' ]] ; then
command="$command -nc"
fi
read -p "Download outside the current directory (y/n) : " opinion
if [[ $opinion == 'n' ]] ; then
command="$command -np"
fi
read -p "Save as HTML extension (y/n) : " opinion
if [[ $opinion == 'y' ]] ; then
command="$command -E"
fi
read -p "Enable compatibility with Windows (y/n) : " opinion
if [[ $opinion == 'y' ]] ; then
command="$command --restrict-file-names=windows"
fi
echo "Downloading ... "
echo
$command $1
echo
echo "End"
exit 1
fi./sitedwn.sh <URL>
This is not it.. there's hell lot more but beyond the scope of this post. So just read the Manuals (worth reading specially the Examples part). There are GUI version for wget :
- GWget - For Gnome
- Kget - For KDE
References : man pages of wget, Linux Journal