wget: Downloads Files Noninteractively


wget: Downloads Files Noninteractively

The wget utility is a noninteractive, command line utility that can retrieve files from the Web using HTTP, HTTPS, and FTP.

The following simple example uses wget to download Red Hat's home page, named index.html, to a file with the same name:

$ wget http://www.redhat.com
--19:42:53--  http://www.redhat.com/
           => 'index.html'
Resolving www.redhat.com... 209.132.177.50
Connecting to www.redhat.com|209.132.177.50|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 12,544 (12K) [text/html]
100%[==========================================================>] 12,544        --.--K/s
19:42:54 (102.49 KB/s) - 'index.html' saved [12544/12544]

Use the b option to run wget in the background and to redirect its standard error to a file named wget-log:

$ wget -b http://example.com/big_file.tar.gz
Continuing in background, pid 10752.
Output will be written to 'wget-log'.

If you download a file that would overwrite a local file, wget appends a period followed by a number to the filename. Subsequent background downloads are then logged to wget-log.1, wget-log.2, and so on.

The c option continues an interrupted download. The next command continues the download from the previous example in the background:

$ wget -b -c http://example.com/big_file.tar.gz