Menu

Showing posts with label Other. Show all posts
Showing posts with label Other. Show all posts

Wednesday, June 1, 2011

Install wget and download files using it

How to install wget in Windows?


Step 1: Download wget.exe file from net.

Step 2: Add the location where this file is saved in the path variable.

Step 3: Go to command prompt and type wget.


How to install wget in Linux?

In linux, wget will be installed by default. If not, do yum search and install the latest version
>yum search wget
>yum install wget.XXXX


How to download a file from web using wget command?

wget [OPTIONS] [URL]

The below command will download the page from google and save it google.html file. The \ is line separator in Linux. In windows ^ is a line separator.

    wget      --quiet \
                 --timeout=30 \
                 --dns-timeout=30 \
                 --connect-timeout=30 \
                 --read-timeout=30 \
                 --tries=5 \
                 --waitretry=5 \
                 --timestamping \
                 --output-document google.html \
                 http://www.google.com

Here are some of the interesting options in wget.
  1. timeout              - Specify timeout            
  2. dns-timeout        - Dns lookup timeout
  3. connect-timeout - connection timeout
  4. read-timeout      - reading  timeout
  5. tries                - how many times it should try to download
  6. waitretry            - how many times it should retry to download
  7. timestaming          - Don’t download if it is newer than the local file.
  8. output-document   - save the download page in this file
  9. quiet                - Don’t output log
  10. verbose              - output the log
  11. ftp-user             - username of the ftp server, if you download using ftp protocol.
  12. ftp-password         - password of the ftp user