Wget Use Case Summary

Wget is a free utility for non-interactive download of files from the Web. It supports HTTP, HTTPS, and FTP protocols, as well as retrieval through HTTP proxies. It is fault-tolerance, has big overlap with curl, both heavily using.

wget -h and man page are informative.

值得注意的是,不同Linux版本wget支持的选项可能不完整。

Continue download

1
2
3
## assume the url is disrupted and leave a incomplete file in current folder
## -c,--continue: continue
wget <url> -c

Authz

If you proxy, http_proxy for http connection, https_proxy for https connection. Wget basic authentication challenge

1
2
3
4
5
6
7
8
9
10
11
## http use http_proxy flag

## other options:
## --no-check-certificate: Don't check the server certificate against the available certificate authorities
## --connect-timeout: seconds, TCP connections that take longer to establish will be aborted
## -e, --execute: commands, env varaible
## --auth-no-challenge: for server never sends HTTP authentication challenges, not recommended
wget --no-check-certificate --connect-timeout 10 -e http_proxy="envoy:10000" http://www.httpbin.org/ip --auth-no-challenge --user xxx --password xxx

## https use https_proxy flag
wget --no-check-certificate --connect-timeout 10 -e https_proxy="envoy:10000" https://www.httpbin.org/ip --auth-no-challenge --user xxx --password xxx
0%