The linux wget command is a fantastic tool not only for system administrators but only for other linux users. It comes with every linux distribution and the simple usage of it make from it a handy tool. When you find something on the internet with the web browser and you want to quickly take it to a linux machine you must open a command console.
This amazing utility not only downloads from HTTP or HTTPS servers and it can also download from FTP sources. It has amazing features like FTP, HTTP, HTTPS username and password authentication, resuming, time-out session, proxy usage, quota, file name restriction, local and remote encoding, certificate file when using HTTPS, recursive retrieval options, recursive download and so on. I will not cover all these. You can always consult the manual page of wget which is quite complex. Let's look closer to the file options that you can find useful.
If you want for example to download only certain types of files you can use the flag "-A" followed by the extension of the file:
wget -A pdf,mov,zip http:_//web_address_example_site/some_folder/
This is useful for situations where the web directory contains lots of mixed files and you are interested in some of them.
Another interesting option is the time-stamping usage. If you want to preserve file that from the web and to have locally the same modification dates, the option "-S" can be used. The file saved locally will have the same time stamp on your local disk and later if you want to see if the file has modified you can use the option "-N" and if the file has changed wget downloads it, and if not it do nothing.
Sometimes you have a very slow connection with the web server and it continuously interrupts. If the file is lengthy the connection will be lost before the file to be downloaded. For this situation you have the option "-t" or number or tries. The default is 20 but you can rise it to 50 and the chances to get the file will be greater.
The "Continue option" is very useful for large files like avi's. If you have a great file to download and the connection is lost many times, this "-C" option takes the file from where it left. It takes exactly the same bit where it was in the moment of interruption.
There are of course many other options, but I home I raised the curiosity to use this amazing feature.
Post a Comment