To create a mirror of a website with wget, use the -m option. To download a file from a password-protected FTP server, specify the username and password as shown below: wget -ftp-user=FTP_USERNAME -ftp-password=FTP_PASSWORD Creating a Mirror of a Website # If you specify - as a filename, URLs will be read from the standard input. The following example shows how to download the Arch Linux, Debian, and Fedora iso files using the URLs specified in the linux-distros.txt file: wget -i linux-distros.txt If you want to download multiple files at once, use the -i option followed by the path to a local or external file containing a list of the URLs to be downloaded. The command above will emulate Firefox 60 requesting the page from Downloading Multiple Files # In situations like this, to emulate a different browser, pass the -U option. Sometimes when downloading a file, the remote server may be set to block the Wget User-Agent. To watch the status of the download, use the tailĬommand: tail -f wget-log Changing the Wget User-Agent # In the following example, we are downloading the OpenSuse iso file in the background: wget -b īy default, the output is redirected to wget-log file in the current directory. To download in the background, use the -b option. If the remote server does not support resuming downloads, wget will start the download from the beginning and overwrite the existing file. In the following example, we are resuming the download of the Ubuntu 18.04 iso file: wget -c This is useful if your connection drops during a download of a large file, and instead of starting the download from scratch, you can continue the previous one. You can resume a download using the -c option. This option is useful when you don’t want wget to consume all the available bandwidth. The following command will download the Go binary and limit the download speed to 1MB: wget -limit-rate=1m Append k for kilobytes, m for megabytes, and g for gigabytes. By default, the speed is measured in bytes/second. To limit the download speed, use the -limit-rate option. The command above tells wget to save the CentOS 7 iso file to the /mnt/iso directory. To save the file to a specific location, use the -P option: wget -P /mnt/iso Downloading a File to a Specific Directory #īy default, wget will save the downloaded file in the current working directory. Zip file from GitHub as latest-hugo.zip instead of its original name. The command above will save the latest hugo To save the downloaded file under a different name, pass the -O option followed by the chosen name: wget -O latest-hugo.zip Saving the Downloaded File Under Different Name # If the file already exists, wget will add. To turn off the output, use the -q option. Once the download is complete, you can find the downloaded file in your current working directory As you can see from the image above, wget starts by resolving the domain’s IP address, then connects to the remote server and starts the transfer.ĭuring the download, wget shows the progress bar alongside the file name, file size, download speed, and the estimated time to complete the download.
0 Comments
Leave a Reply. |