How to download using Wget in Linux

Source: Internet
Author: User
Tags ftp centos

Use examples:

1. Download a single file

The code is as follows:

$ wget Http://osmond.cn/cdbe/CDBE.zip

2. Download a single file in the background of continuous transmission mode

The code is as follows:

$ WGET-BC http://ftp.hostrino.com/pub/centos/5.0/isos/i386/centos-5.0-i386-bin-

3, only download a single HTML file, to ensure that the impact of the page display all elements are downloaded, and re-establish the link

The code is as follows:

$ wget-p-K http://osmond.cn/cdbe/manual/index.html

4. Download www.xxx.org/pub/path/Entire Directory

The code is as follows:

Wget-c-r-np-k-l-p www.xxx.org/pub/path/

At the time of downloading. A picture or connection that is useful to an external domain name. Use the-h parameter if you need to download simultaneously.

The code is as follows:

Wget-np-nh-r--span-hosts www.xxx.org/pub/path/

-C Breakpoint continued transmission

-r recursive download, download all files in a directory (including subdirectories) of a specified Web page

-nd recursive download without creating a layer of directory, download all files to the current directory

-NP Recursive downloads do not search the upper directory, such as Wget-c-R www.xxx.org/pub/path/

Without the parameter-NP, you will also download the other files under the directory pub at the top of the path

-K the absolute link to the relative link, download the entire site offline browsing the Web page, preferably with this parameter

-L does not enter other hosts when recursion, such as Wget-c-R www.xxx.org/

If there is one such link in the site:

www.yyy.org, without parameter-L, will be like a fire burning mountain, will be recursive download www.yyy.org Web site

-P Download all the files required for the Web page, such as pictures

-a specifies a list of file styles to download, with multiple styles separated by commas

-I followed by a file indicating the URL to download

5, download the entire site to do the local mirror site http://www.xyz.edu.cn content

The code is as follows:

$ wget–m–l4-t0 http://www.xyz.edu.cn

Or

The code is as follows:

Wget-r-p-np-k http://dsec.pku.edu.cn/~usr_name/

6, only download the directory designated by the Web site, to avoid the spread of other directories to the remote host, and refused to download gif and JPG files

The code is as follows:

$ wget-r–l-r gif,jpg http://www.xyz.edu.cn/doc/

7. Recursively download the blog and wiki directory under http://www.xyz.edu.cn and save the file suffix as HTML

The code is as follows:

$ wget-r-k-p-np-e-I blog,wiki http://www.xyz.edu.cn

8, the recursive download Http://ayo.freshrpms.net/redhat/9/i386/updates/RPMS all the files to the current directory

The code is as follows:

$ wget-r-nh-nd Http://ayo.freshrpms.net/redhat/9/i386/updates/RPMS

9, Bulk download (first of all to download the URL of the file to write a row, generate file Download.txt)

The code is as follows:

$ wget-i Download.txt-o Download.log

10, use the agent to download

The code is as follows:

$ wget-y-I download.txt-o download.log

Agents can be set in environment variables or WGETRC files

How to set up a proxy

The code is as follows:

# Set up agents in environment variables

Export proxy=http://214.97.161.94:80/

# set up agents in ~/.WGETRC

Http_proxy = http://214.97.161.94:80/

Ftp_proxy = http://214.97.161.94:80/

11.* downloads a partially downloaded file on an unstable network and downloads during idle hours

The code is as follows:

Wget-t 0-w 31-c http://dsec.pku.edu.cn/BBC.avi-o Down.log &

# or read the list of files to download from filelist

Wget-t 0-w 31-c-B ftp://dsec.pku.edu.cn/linuxsoft-i filelist.txt-o

Down.log &

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.