Common wget usage examples

Wget is one of my favorite tools in Linux/Unix world. Sometimes, you want to download all the rpm, deb, iso, or tgz files and save them into a directory. Sometimes you need to use it to check your web server status. Here are some of my favorite wget usage examples:

$ wget -i filename.txt
Put the URLs in filename.txt and run wget against it to download a list of files automatically.

How to download large files in a bad connection? You can have a try with –continue option:
$ wget -c
The “-c” option tells wget to continue and retry until downloading completed.

$ wget –spider
This command is very useful to check a web server’s running status. A “200 OK” in the output means your web server is ready for request.

$ wget -r -np -nd
This little command is probably the most used variation. It downloads all files in the /files/ directory on, without traversing up to parent directories (-np), and without recreating the directory structure on your machine (-nd).

$ wget -r -np -nd –accept=iso
Adding the -–accept argument with a list of file extensions (comma separated) will grab only these files in the right extensions.

Share Button

Leave a comment

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