wget is a tool for downloading files in Linux system. Its function is still quite a lot. It can download a single file or download it in segments. The following small series will be used for the usage of wget command. Give everyone an example introduction.
Examples:
Example 1: download a single file
# wget http://mirror.nbrc.ac.in/CentOS/7.0.1406/isos /x86_64/CentOS-7.0-1406-x86_64-DVD.iso
This command downloads the CentOS 7 ISO file to the user's current working directory.
Example 2: Resuming Segmented Download Files
There are always some scenes. When we started downloading a large file, the Internet was disconnected. In that case, we can use the ‘-c’ option of the wget command to resume the download from the breakpoint.
# wget -c http://mirror.nbrc.ac.in/centos/7.0.1406/isos/x86_64/CentOS-7.0-1406-x86_64-DVD.iso
Example 3: Downloading files in the background
We can use the ‘-b’ option in the wget command to download files in the background.
linuxtechi@localhost:~$ wget -b http://mirror.nbrc.ac.in/centos/7.0.1406/isos/x86_64/
CentOS-7.0-1406-x86_64 -DVD.iso
Continuingin background, pid 4505.
Output will be written to ‘wget-log’.
As we saw above, the download process is captured in the ‘wget-log’ file in the user's current directory.
linuxtechi@localhost:~$tail -f wget-log
2300K. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .0%48.1K18h5m
2350K. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .0%53.7K18h9m
2400K. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .0%52.1K18h13m
2450K. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .0%58.3K18h14m
2500K. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .0%63.6K18h14m
2550K. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .0%63.4K18h13m
2600K. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .0%72.8K18h10m
2650K. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .0%59.8K18h11m
2700K. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .0%52.8K18h14m
2750K. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .0%58.4K18h15m
2800K. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .0%58.2K18h16m
2850K. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .0%52.2K18h20m
Example 4: Limit download rate
By default, the wget command attempts to download at full speed, but sometimes you may be using a shared internet, then if you try to use When wget downloads huge files, it slows down other users' networks. At this point, if you use the ‘-limit-rate’ option to limit the download rate, you can avoid this.
#wget --limit-rate=100k http://mirror.nbrc.ac.in/centos/7.0.1406/isos/x86_64/CentOS-7.0-1406-x86_64-DVD.iso
In the above example, the download rate was limited to 100k.
Instance 5: Using the ‘-i’ option to download multiple files
If you want to use the wget command to download multiple files, first create a text file and All URLs are added to this file.
# cat download-list.txt
url1
url2
url3
url4
Now, issue The following command:
# wget -i download-list.txt
Example 6: Increase the number of retries
We can use the ‘-tries’ option to increase the weight The number of trials. By default, the wget command will retry 20 times until the download is successful.
This option is useful when you have problems with an Internet connection while downloading a large file, because in that case, it increases the chances of a download failure.
# wget --tries=75 http://mirror.nbrc.ac.in/centos/7.0.1406/isos/x86_64/CentOS-7.0-1406-x86_64-DVD.iso
Example 7: Using the -o option to redirect the wget log to a file
We can use the ‘-o’ option to redirect the log of the wget command to a log file.
#wget -o download.log http://mirror.nbrc.ac.in/centos/7.0.1406/isos/x86_64/CentOS-7.0-1406-x86_64-DVD.iso
The above command will create a download.log file in the user's current directory.
Example 8: Download the entire site for local viewing
# wget --mirror -p --convert-links -P . /Local-Folder website-url
Given
–mirror : Turn on the option for mirroring.
-p : Download all necessary files to display the specified HTML page correctly.
–convert-links : After the download is complete, convert the links in the document for local viewing.
-P . /Local-Folder : Save all files and directories to the specified directory.
Example 9: Rejecting file types during download
When you are planning to download the entire site, we can use the ‘-reject’ option to force wget not to download images.
# wget --reject=png Website-To-Be-Downloaded
Example 10: Using wget -Q to set download quotas
We can use ‘-Q’ The option forces the wget command to exit the download when the download size exceeds a certain size.
# wget -Q10m -i download-list.txt
Note that quotas do not affect the download of individual files. So, if you specify wget -Q10m ftp://wuarchive.wustl.edu/ls-lR.gz, the entire contents of ls-lR.gz will be downloaded. This is also true when downloading multiple URLs specified on the command line. However, when recursively or retrieving from an input file, it is still worthwhile. Therefore, you can safely type ‘wget -Q10m -i download-list.txt’, when the quota is exceeded, the download will exit.
Example 11: Downloading a file from a password-protected website
# wget --ftp-user=“user-name” --ftp-password=“password” Download-URL
Another way to specify a username and password is in the URL.
Either method exposes your password to those who run the "ps” command. To prevent passwords from being viewed, save them in ��� to .wgetrc or .netrc and use “chmod” to set the appropriate permissions to protect these files from view by other users. . If the passwords are really important, don't walk away while they are still lying in the file, edit the file after Wget starts downloading, or delete them.
The above is an example of the use of the Linux download tool wget command. From these examples, we can know that the function of wget is similar to the Thunder we usually use, and it can achieve speed limit, multiple downloads and other functions.
In Linux commands, we will often use cd, ls and other commands, but commands like touch are less use
There are many ways to upgrade the kernel of Linux system. It is the simplest way to install kernel
Configuring swap space for computers can make full use of the system. When physical
ifconfig is a command for Linux to display network devices. It can set the status o
Linux mysql how to change the root password
CentOS telnet exit failure solution
Two classifications of Linux system commands
Linux removes the physical volume of PV in LVM
Linux cancels the SSH login password
Ubuntu 14.04 steps to install Wine
Linux recovery steps for deleting files by lsof command
Ubuntu 12.04 installation Xen FAQ and solution
Installing Linux mint graphic tutorial with U disk under Windows
How to solve the error when modifying the Locale in the Ubuntu system?
How to view the built-in Directx version of Win10 is said to be Directx12 version
How to restore windows 8 boot press F8 to enter advanced boot mode method
Deep technology Win7 Ultimate virtual memory optimization skills
Win7 system computer search function can not be used to solve
Also my hard disk space, XP system weight loss method (3)
Two ways to uninstall the 360 system first aid kit
How to print WPS files horizontally in win7
Win10 10074 preview version of the start menu can not open how to do?
How to delete IE8 browser browsing history in Windows 7 system (two methods)
Win10 how to cancel shortcuts to close the command prompt function