⬇️ 强大的非交互式网络下载工具 - 命令行下载之王
目录
简介
安装
基础语法
基础下载
高级下载
递归下载(整站镜像)
认证与 Cookie
代理设置
SSL/TLS 选项
下载控制
调试与日志
实战示例
技巧与最佳实践
一、简介
1.1 什么是 wget
wget(Web Get)是一个从网络上自动下载文件的自由工具,支持 HTTP、HTTPS 和 FTP 协议。它是一个非交互式工具,可以在后台运行,非常适合脚本和自动化任务。
核心特点:
非交互式,支持后台运行
支持断点续传
支持递归下载(镜像网站)
支持 HTTP/HTTPS/FTP
支持代理和认证
支持限速和重试
支持时间戳和增量下载
1.2 wget vs curl
特性
wget
curl
核心定位
下载工具
请求工具
递归下载
✅ 原生支持
❌
断点续传
✅ -c
✅ -C -
后台运行
✅ -b
❌
镜像网站
✅ -m
❌
发送数据
❌
✅ -d/-F
多协议
HTTP/HTTPS/FTP
20+ 协议
交互式
非交互
非交互
二、安装
2.1 各平台安装
Linux
# Debian/Ubuntu
sudo apt update
sudo apt install wget
# CentOS/RHEL
sudo yum install wget
# Alpine
apk add wget
# Arch Linux
sudo pacman -S wget
macOS
# macOS 自带 curl,但可以安装 wget
brew install wget
# 或使用 MacPorts
sudo port install wget
Windows
# Chocolatey
choco install wget
# Scoop
scoop install wget
# 或使用 WSL
wsl wget URL
2.2 验证安装
wget --version
# 输出: GNU Wget 1.21.4 built on linux-gnu.
# 测试下载
wget --spider https://example.com
三、基础语法
3.1 命令格式
wget [选项] [URL...]
# 基本下载
wget https://example.com/file.zip
# 带选项
wget -c -O myfile.zip https://example.com/file.zip
# 下载多个文件
wget URL1 URL2 URL3
# 从文件读取 URL
wget -i urls.txt
3.2 常用选项
下载控制
选项
说明
示例
-O file
指定输出文件名
wget -O file.zip URL
-P dir
指定保存目录
wget -P /tmp URL
-c
断点续传
wget -c URL
-b
后台下载
wget -b URL
-q
静默模式
wget -q URL
-v
详细输出
wget -v URL
-nv
关闭详细但不静默
wget -nv URL
-i file
从文件读取 URL
wget -i urls.txt
--limit-rate
限速
wget --limit-rate=1M URL
-w seconds
等待间隔
wget -w 2 URL
--waitretry
重试等待
wget --waitretry=5 URL
-t N
重试次数
wget -t 3 URL
-T seconds
超时
wget -T 30 URL
递归下载
选项
说明
示例
-r
递归下载
wget -r URL
-l depth
递归深度
wget -r -l 2 URL
-m
镜像(快捷方式)
wget -m URL
-k
转换链接为本地
wget -r -k URL
-K
保留备份
wget -r -K URL
-p
下载页面资源
wget -p URL
-np
不追溯父目录
wget -r -np URL
-nd
不创建目录
wget -r -nd URL
-x
强制创建目录
wget -x URL
-nH
不创建主机目录
wget -r -nH URL
--cut-dirs=N
跳过 N 层目录
wget --cut-dirs=2 URL
过滤
选项
说明
示例
-A list
接受的文件类型
wget -A jpg,png,gif URL
-R list
拒绝的文件类型
wget -R exe,dmg URL
--accept-regex
正则接受
wget --accept-regex URL
--reject-regex
正则拒绝
wget --reject-regex URL
-D list
接受的域名
wget -D example.com URL
--exclude-domains
排除域名
wget --exclude-domains URL
-I list
包含目录
wget -I /images,/css URL
-X list
排除目录
wget -X /admin,/private URL
-B URL
基础 URL
wget -B https://example.com URL
认证与 Header
选项
说明
示例
--user=USER
用户名
wget --user=admin URL
--password=PASS
密码
wget --password=123 URL
--http-user
HTTP 用户名
wget --http-user=admin URL
--http-password
HTTP 密码
wget --http-password=pass URL
--header
自定义头
wget --header="X-Key: val" URL
--load-cookies
加载 Cookie
wget --load-cookies=file URL
--save-cookies
保存 Cookie
wget --save-cookies=file URL
SSL/代理
选项
说明
示例
--no-check-certificate
跳过证书验证
wget --no-check-certificate URL
--ca-certificate
CA 证书
wget --ca-cert=ca.pem URL
-e use_proxy=yes
启用代理
配合环境变量
--no-proxy
不使用代理
wget --no-proxy URL
四、基础下载
4.1 下载文件
# 基本下载(使用远程文件名)
wget https://example.com/file.zip
# 指定文件名
wget -O myfile.zip https://example.com/file.zip
# 指定保存目录
wget -P /tmp/downloads https://example.com/file.zip
# 同时指定目录和文件名
wget -O /tmp/myfile.zip https://example.com/file.zip
4.2 下载多个文件
# 直接指定多个 URL
wget URL1 URL2 URL3
# 从文件读取 URL
cat > urls.txt << EOF
https://example.com/file1.zip
https://example.com/file2.zip
https://example.com/file3.zip
EOF
wget -i urls.txt
# 从标准输入
echo "https://example.com/file.zip" | wget -i -
# 批量下载带编号的文件
for i in {1..100}; do
wget "https://example.com/file_${i}.jpg"
done
# 或使用 wget 自带方式
seq 1 100 | while read i; do
echo "https://example.com/file_${i}.jpg"
done > urls.txt
wget -i urls.txt
4.3 静默下载
# 静默模式(不输出任何信息)
wget -q https://example.com/file.zip
# 关闭详细输出(仅显示基本进度)
wget -nv https://example.com/file.zip
# 静默 + 输出到 /dev/null(测试用)
wget -q -O /dev/null https://example.com/file.zip
# 显示进度条
wget --show-progress -q https://example.com/file.zip
4.4 后台下载
# 后台下载
wget -b https://example.com/large-file.zip
# 输出: Continuing in background, pid 12345.
# 日志写入 wget-log
# 指定日志文件
wget -b -o download.log https://example.com/large-file.zip
# 查看进度
tail -f wget-log
# nohup 方式(退出终端不断开)
nohup wget -c https://example.com/large-file.zip &
五、高级下载
5.1 断点续传 (-c)
# 续传下载(如果文件已部分下载)
wget -c https://example.com/large-file.zip
# 续传 + 后台
wget -c -b https://example.com/large-file.zip
# 续传 + 限速
wget -c --limit-rate=1M https://example.com/large-file.zip
# 如果服务器不支持续传,会从头开始
# 使用 --no-if-modified-since 强制续传
5.2 限速下载
# 限速 1MB/s
wget --limit-rate=1M https://example.com/file.zip
# 限速 500KB/s
wget --limit-rate=500k https://example.com/file.zip
# 限速 10MB/s
wget --limit-rate=10M https://example.com/file.zip
# 动态限速
wget --limit-rate=2M -c https://example.com/file.zip
5.3 超时与重试
# 连接超时 10 秒
wget -T 10 https://example.com/file.zip
# 总超时 60 秒
wget -T 60 https://example.com/file.zip
# 重试 5 次
wget -t 5 https://example.com/file.zip
# 无限重试
wget -t 0 https://example.com/file.zip
# 重试间隔 5 秒
wget --waitretry=5 -t 3 https://example.com/file.zip
# 等待间隔(下载间隔)
wget -w 2 -i urls.txt # 每个 URL 间隔 2 秒
# 随机等待(0.5-1.5 秒,避免被封)
wget --random-wait -i urls.txt
# 组合
wget -T 30 -t 3 --waitretry=5 https://example.com/file.zip
5.4 条件下载
# 只在文件比本地新时下载
wget -N https://example.com/data.json
# 检查时间戳但不下载
wget --spider -N https://example.com/data.json
# 如果文件已存在则不下载
wget -nc https://example.com/file.zip
# no-clobber,不覆盖已有文件
# 组合使用
wget -nc -c https://example.com/file.zip
5.5 文件名处理
# 指定文件名
wget -O myfile.zip https://example.com/download?id=123
# 使用 URL 中的文件名
wget --content-disposition https://example.com/download?id=123
# 使用 Content-Disposition 头中的文件名
# 保留远程文件名(默认)
wget https://example.com/file.zip # 保存为 file.zip
# 转义文件名中的特殊字符
wget --restrict-file-names=unix https://example.com/文件名.zip
# 或
wget --restrict-file-names=windows URL
5.6 FTP 下载
# 基本 FTP 下载
wget ftp://ftp.example.com/file.zip
# 带认证
wget --ftp-user=username --ftp-password=password ftp://ftp.example.com/file.zip
# 或在 URL 中指定
wget ftp://user:pass@ftp.example.com/file.zip
# 递归下载 FTP 目录
wget -r ftp://ftp.example.com/directory/
# 不进入父目录
wget -r -np ftp://ftp.example.com/directory/
# 下载特定类型
wget -r -A "*.txt" ftp://ftp.example.com/directory/
# 被动模式
wget --no-passive-ftp ftp://ftp.example.com/file.zip
六、递归下载(整站镜像)
6.1 基本递归下载
# 递归下载(默认深度 5)
wget -r https://example.com/
# 指定深度
wget -r -l 2 https://example.com/
wget -r -l 0 https://example.com/ # 无限深度
# 不追溯父目录
wget -r -np https://example.com/docs/
# 不创建主机目录
wget -r -nH https://example.com/docs/
# 跳过目录层级
wget -r -nH --cut-dirs=2 https://example.com/a/b/docs/
# 不创建目录结构(所有文件放同一目录)
wget -r -nd https://example.com/docs/
6.2 网站镜像 (-m)
# 完整镜像(推荐用于整站下载)
wget -m https://example.com/
# 等价于: -r -N -l inf --no-remove-listing
# 镜像 + 转换链接
wget -m -k https://example.com/
# 镜像 + 转换 + 页面资源
wget -m -k -p https://example.com/
# 镜像 + 不追溯父目录
wget -m -k -p -np https://example.com/docs/
6.3 页面资源下载 (-p)
# 下载页面及所有资源(CSS/JS/图片)
wget -p https://example.com/page.html
# 下载 + 转换链接
wget -p -k https://example.com/page.html
# 下载 + 转换 + 保留原始
wget -p -k -K https://example.com/page.html
# .orig 文件保存原始版本
# 下载单个页面所有资源
wget -p -np -k -E https://example.com/page.html
# -E: 添加 .html 扩展名
6.4 链接转换 (-k)
# 下载后转换链接为本地路径
wget -r -k https://example.com/docs/
# 链接 https://example.com/docs/page2.html → docs/page2.html
# 转换 + 保留原始
wget -r -k -K https://example.com/docs/
# 只转换,不下载
wget -r -k --convert-file-only https://example.com/docs/
6.5 过滤下载
# 只下载图片
wget -r -A jpg,jpeg,png,gif,webp,svg https://example.com/
# 只下载 PDF
wget -r -A pdf https://example.com/docs/
# 排除特定类型
wget -r -R exe,dmg,iso https://example.com/
# 排除目录
wget -r -X /admin,/private,/tmp https://example.com/
# 只包含特定目录
wget -r -I /docs,/images https://example.com/
# 使用正则
wget -r --accept-regex "\.jpg$|\.png$" https://example.com/
# 排除域名
wget -r --exclude-domains=ads.example.com,tracker.com https://example.com/
# 只接受特定域名
wget -r -D example.com,cdn.example.com https://example.com/
# 大小限制
wget -r --max-filesize=10M https://example.com/
6.6 常用镜像组合
# 镜像文档站
wget -m -k -p -E -np --adjust-extension \
https://docs.example.com/
# 下载特定目录
wget -r -np -nH --cut-dirs=1 -A pdf \
https://example.com/docs/
# 下载图片
wget -r -l 1 -A jpg,png,gif -nd -P ./images \
https://example.com/gallery/
# 下载整站(排除大文件)
wget -m -R zip,tar,gz,iso,dmg \
https://example.com/
# 下载博客
wget -m -k -p -E -np --restrict-file-names=windows \
https://blog.example.com/
七、认证与 Cookie
7.1 HTTP 基本认证
# 命令行指定
wget --http-user=admin --http-password=secret https://example.com/protected/
# 或使用 URL 格式
wget https://admin:secret@example.com/protected/
# 使用 .wgetrc 配置
cat >> ~/.wgetrc << EOF
http_user = admin
http_passwd = secret
EOF
7.2 FTP 认证
wget --ftp-user=username --ftp-password=password \
ftp://ftp.example.com/file.zip
# 或 URL 格式
wget ftp://user:pass@ftp.example.com/file.zip
7.3 Cookie
# 使用 Cookie 文件
wget --load-cookies cookies.txt https://example.com/protected/
# 保存 Cookie
wget --save-cookies cookies.txt --keep-session-cookies \
https://example.com/login
# 先登录获取 Cookie,再访问
# 步骤 1:登录
wget --save-cookies cookies.txt \
--keep-session-cookies \
--post-data="user=admin&pass=secret" \
https://example.com/login
# 步骤 2:使用 Cookie 访问
wget --load-cookies cookies.txt \
https://example.com/protected/file.zip
# 使用 Cookie 头
wget --header="Cookie: session=abc123" \
https://example.com/protected/
# Netscape Cookie 文件格式
cat > cookies.txt << EOF
.example.com TRUE / FALSE 0 session abc123
.example.com TRUE / FALSE 0 token xyz789
EOF
7.4 自定义请求头
# User-Agent
wget --user-agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36" \
https://example.com/file.zip
# Referer
wget --referer="https://example.com/page" \
https://example.com/file.zip
# 自定义头
wget --header="X-API-Key: your-key" \
https://api.example.com/data
# 多个头
wget --header="Authorization: Bearer TOKEN" \
--header="Accept: application/json" \
https://api.example.com/data
# POST 请求
wget --post-data='{"key":"value"}' \
--header="Content-Type: application/json" \
https://api.example.com/endpoint
# POST 文件
wget --post-file=request.json \
--header="Content-Type: application/json" \
https://api.example.com/endpoint
7.5 Bearer Token
# 使用 Bearer Token
wget --header="Authorization: Bearer YOUR_TOKEN" \
https://api.example.com/data
# 下载 API 数据
wget -O data.json \
--header="Authorization: Bearer YOUR_TOKEN" \
"https://api.example.com/v1/users?page=1"
八、代理设置
8.1 HTTP 代理
# 环境变量方式
export http_proxy=http://proxy:8080
export https_proxy=http://proxy:8080
wget https://example.com/file.zip
# 命令行方式
wget -e use_proxy=yes -e http_proxy=proxy:8080 \
https://example.com/file.zip
# 带认证的代理
export http_proxy=http://user:pass@proxy:8080
export https_proxy=http://user:pass@proxy:8080
wget https://example.com/file.zip
8.2 SOCKS 代理
# wget 本身不支持 SOCKS 代理
# 使用 proxychains 或 socat
# 方法 1:proxychains
proxychains wget https://example.com/file.zip
# 方法 2:socat 转发
socat TCP-LISTEN:8888,fork SOCKS5:proxy:target:443 &
wget -e use_proxy=yes -e http_proxy=127.0.0.1:8888 \
https://example.com/file.zip
8.3 wgetrc 配置
# ~/.wgetrc 全局配置
cat >> ~/.wgetrc << EOF
# 代理设置
use_proxy = on
http_proxy = http://proxy:8080
https_proxy = http://proxy:8080
ftp_proxy = http://proxy:8080
# 默认选项
continue = on
tries = 3
timeout = 30
waitretry = 5
user_agent = Mozilla/5.0
# 下载目录
dir_prefix = /tmp/downloads
EOF
# 不使用代理
wget --no-proxy https://example.com/file.zip
九、SSL/TLS 选项
9.1 基本选项
# 跳过证书验证
wget --no-check-certificate https://self-signed.example.com/
# 指定 CA 证书
wget --ca-certificate=/path/to/ca.pem https://example.com/
# 指定 CA 目录
wget --ca-directory=/etc/ssl/certs https://example.com/
# 指定客户端证书
wget --certificate=/path/to/client.pem \
--private-key=/path/to/key.pem \
https://example.com/
# 带密码的私钥
wget --certificate=client.pem \
--private-key=key.pem \
--private-key-type=PEM \
https://example.com/
9.2 TLS 版本控制
# 使用 TLS 1.2
wget --secure-protocol=TLSv1_2 https://example.com/
# 使用 TLS 1.3
wget --secure-protocol=TLSv1_3 https://example.com/
# 自动选择最高版本
wget --secure-protocol=auto https://example.com/
# 只使用 SSL v3(不安全)
wget --secure-protocol=SSLv3 https://example.com/
十、下载控制
10.1 进度显示
# 默认进度条
wget https://example.com/file.zip
# 点阵进度
wget --progress=dot https://example.com/file.zip
# 点阵(大文件)
wget --progress=dot:mega https://example.com/file.zip
# 关闭进度
wget -nv https://example.com/file.zip
# 显示进度(配合 -q)
wget -q --show-progress https://example.com/file.zip
10.2 下载队列
# 从文件读取 URL
cat > downloads.txt << EOF
https://example.com/file1.zip
https://example.com/file2.zip
https://example.com/file3.zip
EOF
# 顺序下载,每个间隔 2 秒
wget -i downloads.txt -w 2
# 随机间隔(0.5-1.5 秒)
wget -i downloads.txt --random-wait
# 限制重试
wget -i downloads.txt -t 3 -T 30
# 断点续传
wget -c -i downloads.txt
# 指定输出目录
wget -P /tmp/downloads -i downloads.txt
10.3 增量下载
# 只下载比本地新的文件
wget -N -r -l 1 https://example.com/data/
# 时间戳 + 不覆盖
wget -N -nc -r https://example.com/data/
# 基于时间范围
wget --timestamping --no-use-server-timestamps \
--header="If-Modified-Since: Wed, 01 Jan 2024 00:00:00 GMT" \
https://example.com/data.json
10.4 配额控制
# 下载配额(总大小限制)
wget -Q 100m -i urls.txt # 总共最多下载 100MB
# 无限制(默认)
wget -i urls.txt
# 配额 + 递归
wget -Q 500m -r -l 2 https://example.com/
十一、调试与日志
11.1 调试输出
# 详细输出
wget -v https://example.com/file.zip
# 调试模式
wget -d https://example.com/file.zip
# 只测试(不下载)
wget --spider https://example.com/file.zip
# 查看响应头
wget -S https://example.com/file.zip
# 只显示服务器响应
wget -S --spider https://example.com/file.zip
11.2 日志
# 日志到文件
wget -o download.log https://example.com/file.zip
# 追加日志
wget -a download.log https://example.com/file2.zip
# 后台 + 日志
wget -b -o download.log https://example.com/file.zip
# 后台日志查看
tail -f wget-log
11.3 服务器响应分析
# 查看响应头
wget -S --spider https://example.com/
# 查看 HTTP 和响应头
wget -S --server-response --spider https://example.com/
# 查看 SSL 信息
wget --no-check-certificate -S --spider https://example.com/ 2>&1 | grep -i "SSL\|TLS\|certificate"
十二、实战示例
12.1 下载脚本
#!/bin/bash
# download.sh - 可靠下载脚本
URL="$1"
OUTPUT="${2:-$(basename "$URL")}"
wget -c -t 5 --waitretry=5 -T 30 \
--limit-rate=5M \
-O "$OUTPUT" \
"$URL"
if [ $? -eq 0 ]; then
echo "✅ 下载完成: $OUTPUT"
else
echo "❌ 下载失败: $URL"
exit 1
fi
12.2 批量下载
#!/bin/bash
# batch_download.sh - 批量下载
URLS_FILE="$1"
OUTPUT_DIR="${2:-./downloads}"
PARALLEL="${3:-3}"
mkdir -p "$OUTPUT_DIR"
cd "$OUTPUT_DIR"
xargs -n 1 -P "$PARALLEL" wget -c -t 3 -T 30 < "$URLS_FILE"
echo "下载完成: $OUTPUT_DIR"
12.3 网站备份
#!/bin/bash
# backup_site.sh - 网站备份
SITE="$1"
DATE=$(date +%Y%m%d)
BACKUP_DIR="./backups/${SITE}_${DATE}"
mkdir -p "$BACKUP_DIR"
wget -m -k -p -E -np \
--no-check-certificate \
--restrict-file-names=unix \
-P "$BACKUP_DIR" \
"$SITE"
echo "备份完成: $BACKUP_DIR"
12.4 API 数据下载
#!/bin/bash
# api_download.sh - API 数据下载
API_URL="https://api.example.com/v1"
TOKEN="your_token_here"
# 下载数据
wget -O users.json \
--header="Authorization: Bearer $TOKEN" \
--header="Accept: application/json" \
"${API_URL}/users"
# 下载分页数据
for page in {1..10}; do
wget -O "users_page_${page}.json" \
--header="Authorization: Bearer $TOKEN" \
"${API_URL}/users?page=${page}"
done
12.5 GitHub Release 下载
#!/bin/bash
# github_download.sh - 下载最新 Release
REPO="owner/repo"
# 获取最新 Release
LATEST=$(wget -qO- "https://api.github.com/repos/${REPO}/releases/latest")
# 提取下载 URL
echo "$LATEST" | grep -o '"browser_download_url": "[^"]*' | \
sed 's/"browser_download_url": "//' | while read url; do
echo "下载: $url"
wget -c "$url"
done
12.6 检测 URL 可用性
#!/bin/bash
# check_urls.sh - 批量检测 URL
check_url() {
local url=$1
wget --spider -S "$url" 2>&1 | grep "HTTP/" | tail -1 | \
awk -v url="$url" '{print url, $2}'
}
while read url; do
check_url "$url"
done < urls.txt
十三、技巧与最佳实践
13.1 实用别名
# 添加到 ~/.bashrc 或 ~/.zshrc
# 断点续传
alias wgetc='wget -c'
# 静默下载
alias wgetq='wget -q --show-progress'
# 后台下载
alias wgetb='wget -c -b'
# 限速下载
alias wgetl='wget -c --limit-rate=1M'
# 镜像网站
alias wgetm='wget -m -k -p -E -np'
# 下载指定目录
alias wgetd='wget -r -np -nH'
# 只下载图片
alias wgetimg='wget -r -l 1 -A jpg,jpeg,png,gif,webp -nd'
13.2 常见陷阱
陷阱 1:文件名乱码
# URL 编码文件名
wget --restrict-file-names=unix URL
# 或
wget --restrict-file-names=windows URL
# 使用 -O 指定文件名
wget -O "文件名.zip" URL
陷阱 2:下载卡住
# 设置超时
wget -T 30 URL
# 设置重试
wget -t 3 -T 30 URL
# 使用断点续传
wget -c -t 0 -T 60 URL # 无限重试,超时 60 秒
陷阱 3:递归下载过多
# 限制深度
wget -r -l 2 URL
# 限制配额
wget -r -Q 100m URL
# 限制域名
wget -r -D example.com URL
# 排除目录
wget -r -X /admin,/private URL
陷阱 4:SSL 证书错误
# 跳过验证
wget --no-check-certificate URL
# 或更新 CA 证书
sudo update-ca-certificates
陷阱 5:被网站拒绝
# 修改 User-Agent
wget --user-agent="Mozilla/5.0" URL
# 添加 Referer
wget --referer="https://example.com" URL
# 添加 Cookie
wget --header="Cookie: key=value" URL
13.3 wgetrc 配置模板
# ~/.wgetrc 完整配置
# 下载行为
continue = on
tries = 3
timeout = 30
waitretry = 5
random_wait = on
# 限速
limit_rate = 5M
# 用户代理
user_agent = Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36
# SSL
check_certificate = on
# 目录
dir_prefix = /tmp/downloads
dirstruct = on
# 递归
recursive = off
level = 2
no_parent = on
# 日志
logfile = ~/.wget.log
附录
A. 选项速查表
下载选项
选项
说明
-O file
输出文件名
-P dir
保存目录
-c
断点续传
-b
后台运行
-q
静默模式
-i file
URL 文件
-t N
重试次数
-T N
超时(秒)
-w N
等待间隔
-N
时间戳
-nc
不覆盖
递归选项
选项
说明
-r
递归下载
-l N
深度
-m
镜像
-k
转换链接
-p
页面资源
-np
不追溯父目录
-nd
不创建目录
-nH
不创建主机目录
-A list
接受类型
-R list
拒绝类型
认证选项
选项
说明
--user
用户名
--password
密码
--header
自定义头
--load-cookies
加载 Cookie
--save-cookies
保存 Cookie
--no-check-certificate
跳过 SSL 验证
B. 常用命令
# 基本下载
wget URL
# 续传
wget -c URL
# 限速
wget --limit-rate=1M URL
# 后台
wget -b URL
# 镜像
wget -m -k -p URL
# 从文件下载
wget -i urls.txt
# 带认证
wget --user=admin --password=pass URL
# 跳过 SSL
wget --no-check-certificate URL
C. 在线资源
官方文档: https://www.gnu.org/software/wget/manual/
GNU Wget: https://www.gnu.org/software/wget/
man page: https://www.gnu.org/software/wget/manual/wget.html