Wget command to operate instances

Source: Internet
Author: User

Wget command to operate instances
Wget downloading methods include: wget is a tool used to download files in Linux, which has many functions. The following section will introduce the usage of wget commands, the features covered by 11 instances are comprehensive. If you are interested, you can check that wget $ link -- no-check in Linux is a tool for downloading files, it is used in the command line. By default, files are downloaded to the current working path. You can set the-P parameter to specify the file. Usage example: Download the Baidu homepage file ~ In the/download directory, you can see that the output log clearly shows the file storage path in the red box. Instance: instance 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 your current working directory. Example 2: When we start to download a large file, the Internet is disconnected. In this 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 instance 3: Background download file we can let it download files in the background by using the '-B' option in the wget command. 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 can see above, the download process is captured to the 'wget-log' file in the user's current directory. Linuxtechi @ localhost :~ $ Tail-f wget-log 2300 K ................................ 0% 48.1K18h5m 2350 K ................................ 0% 53.7K18h9m 2400 K ................................ 0% 52.1K18h13m 2450 K ................................ 0% 58.3K18h14m 2500 K ................................ 0% 63.6K18h14m 2550 K ................................ 0% 63.4K18h13m 2600 K ................................ 0% 72.8K18h10m 2650 K ................................ 0% 59.8K18h11m 2700 K ................................ 0% 52.8K18h14m 2750 K ................................ 0% 58.4K18h15m 2800 K ................................ 0% 58.2K18h16m 2850 K ................................ 0% 52.2K18h20m instance 4: Limit the download rate. By default, the wget command attempts to download data at full speed, but sometimes you may use the Internet, if you try to use wget to download large files, the network of other users will be slowed down. In this case, if you use the '-limit-rate' option to limit the download speed, you can avoid this situation. # Wget -- limit-rate = 100 k 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 speed is limited to 100 k. Instance 5: Use the '-I' option to download multiple files. If you want to use the wget command to download multiple files, create a text file first, and add all URLs to the file. # Cat download-list.txt url1 url2 url3 url4 now, issue the following command: # wget-I download-list.txt instance 6: Increase retries we can use the '-tries' option to increase retries. By default, the wget command retries 20 times until the download is successful. This option is useful when an Internet connection problem occurs during the process of downloading a large file, because in that case, it increases the chance of downloading failure. # Wget -- tries = 75 http://mirror.nbrc.ac.in/centos/7.0.1406/isos/x86_64/CentOS-7.0-1406-x86_64-DVD.iso instance 7: Use the-o option to redirect wget logs to a file we can use the '-O' option to redirect the wget command logs to a log file. # Wget-o download. log the command above the http://mirror.nbrc.ac.in/centos/7.0.1406/isos/x86_64/CentOS-7.0-1406-x86_64-DVD.iso will create the download. log file under the user's current directory. Instance 8: Download the entire website for local viewing # wget -- mirror-p -- convert-links-P. /Local-Folder website-url view-mirror: Enable the image-applicable option. -P: Download all necessary files that correctly display the specified HTML page. -Convert-links: After the download is complete, the link in the conversion document is used for local viewing. -P. /Local-Folder: Save all files and directories to the specified directory. Instance 9: The file type is denied during the download process. When you are about to download the entire website, you can use the '-reobject' option to force wget not to download images. # Wget -- reject = png Website-To-Be-Downloaded instance 10: we can use the '-Q' option to force the wget command to exit the download when the download size exceeds the specified size. # Wget-Q10m-I download-list.txt note that the quota does not affect the download of a single file. So if you specify wget-Q10m, all contents of the ftp://wuarchive.wustl.edu/ls-lR.gz,ls-lR.gz will be downloaded. This is also true when downloading multiple URLs specified by the command line. However, it is worth using recursively or retrieving from an input file. Therefore, you can safely enter 'wget-Q10m-I download-list.txt 'and the download will exit when the quota is exceeded. Instance 11: download a file from a password-protected website # wget -- ftp-user = user-name -- ftp-password = password Download-URL another way to specify the user name and password is in the URL. Any method exposes your password to those who run the "ps" command. To prevent passwords from being viewed, store them in. wgetrc or. netrc, and use "chmod" to set proper permissions to protect these files from being viewed by other users. If the password is really important, do not go away while they are still lying in the file. After Wget starts downloading, edit the file or delete it. The above is an example of using the wget command of the Linux download tool. From these examples, we can know that the wget function is similar to the thunder function we usually use, supports speed limit and multiple downloads.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.