在 Linux 中下载文件有多种方式,下面按常用程度给你介绍几种最实用的方法,从简单到进阶。
wget(推荐新手)wget https://example.com/file.zip
wget -c https://example.com/file.zip
wget -b https://example.com/file.zip
wget -P /tmp https://example.com/file.zip
✅ 优点:简单、稳定,几乎所有 Linux 都自带
❌ 缺点:不支持复杂交互
curlcurl -O https://example.com/file.zip
curl -o myfile.zip https://example.com/file.zip
curl -# -O https://example.com/file.zip
✅ 优点:功能强大,支持多种协议
❌ 缺点:参数稍多
wget https://github.com/user/repo/archive/refs/heads/main.zip
git clone https://github.com/user/repo.git
⚠️ 需要先安装 git:
sudo apt install git # Ubuntu / Debian
sudo yum install git # CentOS
有些“下载”其实是安装软件:
sudo apt install wget
sudo apt install curl
aria2(多线程下载,速度很快)sudo apt install aria2
aria2c https://example.com/file.iso
✅ 优先使用:
wget -caria2c| 需求 | 命令 |
|---|---|
| 简单下载 | wget url |
| 指定文件名 | curl -o name url |
| 断点续传 | wget -c |
| 多线程 | aria2c |
| 下载 GitHub | git clone |
如果你愿意,可以告诉我:
我可以给你最合适的一条命令。