Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use wget in Linux system

2025-04-08 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces "the use of wget in the Linux system". In the daily operation, I believe that many people have doubts about the use of wget in the Linux system. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts about the use of wget in the Linux system. Next, please follow the editor to study!

Function description: wget uses HTTP and FTP protocols, supports proxy server and breakpoint continuation, and is the most powerful download tool based on the console.

Command format: wget [parameters]

Common parameters:

1. Startup options:

-V: displays the version of wget

-h: displays instructions for the use of wget

-b: transfer to background execution after startup, and log files are written in the "wget-log" file under the current directory.

-e: execute an instruction in .wgetrc

two。 Log file and input file options:

-o: writes the output of the command to the specified file

-a: writes the output of the command to the specified file as an append

-d: display debugging information

-Q: execute in quiet mode (no output)

-v: output details

-nv: turn off detail output, but not in quiet mode

-I: read URL from the specified file

-F: treat the input file as a HTML file (used with the-I parameter)

-B: used with-F, giving priority to URL in the file specified by-I

3. Download options:

-t: when wget cannot establish a connection with the server, try to connect for several times (0 means unlimited)

-O: saves the downloaded file to the specified

-nc: do not overwrite existing files

-C: resume the document

-N: do not retrieve files that are older than local, only download updated files

-S: show server response

-T: set the number of seconds for response timeout to

-w: wait a second between attempts

-Y: connect through a proxy server

-Q: limit the total size of downloaded files to no more than (in bytes). You can use the kPerm suffix.

-- limit-rate=: limit the download transfer rate (in bytes). You can use the suffix kMagne m.

4. Catalog options:

-nd: do not download the directory structure, but heap all the files downloaded from the specified directory on the server to the current directory

-x: create a directory structure that is completely consistent with the remote

-nH: do not create a directory with the domain name of the target host as the directory name, and download the directory structure of the target host directly to the current directory

-P: save the file to the directory PREFIX/.

-- cut-dirs=: ignore layer remote directory

5. HTTP option:

-- http-user=: specifies the user authenticated by the HTTP user

-- http-passwd=: specifies the user password authenticated by the HTTP user

-- no-cache: disables server-side data caching (allowed by default)

-C,-cache=on/off allows / disallows server-side data caching (generally allowed).

-E,-html-extension saves all text/html documents with the .html extension

-ignore-length ignores `Content-Length' header domain

-header=STRING inserts the string STRING into headers

-- proxy-user=: specifies that the Proxy user is

-- proxy-passwd=: specify the Proxy user password as

-E: save all documents of type application/xhtml+xml or text/html with the .html extension

-U: set the name of the agent to instead of Wget/VERSION

-referer=URL contains the `Referer: URL' header in the HTTP request

-s,-save-headers saves the HTTP header to the file

-U,-user-agent=AGENT sets the name of the agent to AGENT instead of Wget/VERSION.

-no-http-keep-alive closes HTTP active links (permanent links).

-cookies=off does not use cookies.

-- load-cookies=FILE loads cookie from the file FILE before starting the session

-save-cookies=FILE saves the cookies to the FILE file after the session ends

6. FTP option:

-- ftp-user=: specifies the FTP user

-- ftp-passwd=: specify the FTP user password

-- no-remove-listing: do not remove temporary .posts files

-- no-glob: turns off the globbing mechanism for file names (that is, no wildcards are used)

-passive-ftp uses passive transfer mode (default).

-active-ftp uses active transfer mode

-- no-passive-ftp: turn off the default passive transfer mode (even if active transfer mode is used)

-- retr-symlinks: when recursive, point the link to a file (not a directory)

7. Use recursion to get options:

-r: open recursive download

-l: specify the maximum recursive depth (inf or 0 for infinity)

-- delete-after: delete downloaded local files

-k: convert non-relative links to relative links

-K (uppercase),-backup-converted backs up file X as X.orig before converting it

-m: enable the option suitable for mirroring, which is equivalent to-N-r-l inf-- no-remove-listing

-p: to ensure that all elements used to display the downloaded web page are downloaded, such as images, sounds, and stylesheets used in the web page

8. Allow and deny options for recursion:

-A: specify the extension file names that are allowed to be downloaded (separated by commas)

-R: specify an extended file name that forbids downloading (separated by commas)

-D: specify the domain name that is allowed to download

-- exclude-domains=: specify a domain name that forbids downloading

-- follow-ftp: tracks FTP links in HTML documents

-- follow-tags=: specify a comma-separated list of tracked HTML tags in

-- ignore-tags=: specify a comma-separated list of HTML tags that are not tracked in

-G,-ignore-tags=LIST semicolon separated list of ignored HTML tags

-H: go to external host when recursive

-L: only track relative links

-I: in the list of directories that are allowed to download

-X: in the specified list of directories that are prohibited from downloading

-np: do not trace back to the parent directory, that is, download only the contents of the specified directory and its subdirectories of the target site

At this point, the study of "how to use wget in Linux system" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report