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://

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

The code is as follows:


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

4. Download Directory

The code is as follows:


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:


-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

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

If there is one such link in the site:, without parameter-L, will be like a fire burning mountain, will be recursive download 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 content

The code is as follows:

$ wget–m–l4-t0


The code is as follows:


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

7. Recursively download the blog and wiki directory under and save the file suffix as HTML

The code is as follows:

$ wget-r-k-p-np-e-I blog,wiki

8, the recursive download Http:// all the files to the current directory

The code is as follows:

$ wget-r-nh-nd Http://

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=

# set up agents in ~/.WGETRC

Http_proxy =

Ftp_proxy =

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 Down.log &

# or read the list of files to download from filelist

Wget-t 0-w 31-c-B filelist.txt-o

Down.log &

Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

11.11 Big Sale for Cloud

Get Unbeatable Offers with up to 90% Off,Oct.24-Nov.13 (UTC+8)

Get It Now >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

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: and provide relevant evidence. A staff member will contact you within 5 working days.