mirror of
https://github.com/LCTT/TranslateProject.git
synced 2025-02-19 00:30:12 +08:00
120 lines
4.2 KiB
Markdown
120 lines
4.2 KiB
Markdown
|
[#]: subject: "How to Fix: bash wget Command Not Found Error"
|
|||
|
[#]: via: "https://www.debugpoint.com/wget-not-found-error/"
|
|||
|
[#]: author: "Arindam https://www.debugpoint.com/author/admin1/"
|
|||
|
[#]: collector: "lkxed"
|
|||
|
[#]: translator: "geekpi"
|
|||
|
[#]: reviewer: " "
|
|||
|
[#]: publisher: " "
|
|||
|
[#]: url: " "
|
|||
|
|
|||
|
如何修复:“bash wget Command Not Found” 错误
|
|||
|
======
|
|||
|
|
|||
|
**以下是你如何在 Debian、Ubuntu 和其他发行版中修复 “bash: wget command not found” 的错误。**
|
|||
|
|
|||
|
著名的 wget 工具被用来通过终端从 URL 下载任何文件。它是 Linux 终端中最流行和最快速的工具之一。
|
|||
|
|
|||
|
作为一个 GNU 工具,wget 带来了一些奇妙的功能。你可以实现任何项目,如从网上提取信息、下载文件、暂停/恢复等。
|
|||
|
|
|||
|
然而,许多 [Linux 发行版][1]在默认安装时并没有附带这个工具。因此,当你想用 wget 下载一些文件时,你会得到 wget 命令未找到的错误。
|
|||
|
|
|||
|
修复它其实很容易。
|
|||
|
|
|||
|
### 修复 wget 命令未找到
|
|||
|
|
|||
|
你所需要做的就是打开终端,运行以下命令来安装 wget。
|
|||
|
|
|||
|
对于 Ubuntu, Linux Mint, elementaryOS, Debian 和相关发行版:
|
|||
|
|
|||
|
```
|
|||
|
sudo apt install wget
|
|||
|
```
|
|||
|
|
|||
|
Arch Linux:
|
|||
|
|
|||
|
```
|
|||
|
pacman -S wget
|
|||
|
```
|
|||
|
|
|||
|
对于 Fedora(虽然它默认包括):
|
|||
|
|
|||
|
```
|
|||
|
sudo dnf install wget
|
|||
|
```
|
|||
|
|
|||
|
安装后,你可以使用 wget 程序。你也可以通过检查其版本来验证它是否正确安装。
|
|||
|
|
|||
|
```
|
|||
|
wget --version
|
|||
|
```
|
|||
|
|
|||
|
### 如何使用 wget
|
|||
|
|
|||
|
下面是一些关于如何使用 wget 程序的例子。
|
|||
|
|
|||
|
命令的语法如下:
|
|||
|
|
|||
|
```
|
|||
|
wget [选项]… [URL]…
|
|||
|
```
|
|||
|
|
|||
|
例如,如果我想下载 Ubuntu 的 ISO 文件,那么我可以运行下面的命令,用直接的 URL 下载。
|
|||
|
|
|||
|
```
|
|||
|
wget https://releases.ubuntu.com/22.04.1/ubuntu-22.04.1-desktop-amd64.iso
|
|||
|
```
|
|||
|
|
|||
|
![如何使用 wget 的例子][2]
|
|||
|
|
|||
|
同样,你也可以使用上述命令下载,或者,通过下面描述的几个开关组合。你也可以通过 `wget --help` 命令得到这个。
|
|||
|
|
|||
|
```
|
|||
|
-t, --tries=NUMBER 设置重试次数为 NUMBER(0 为不限)。
|
|||
|
--retry-connrefused 即使连接被拒绝,也要重试。
|
|||
|
--retry-on-http-error=ERRORS 逗号分隔的 HTTP 错误列表,以便重试。
|
|||
|
-O, --output-document=FILE 将文件写入 FILE 中
|
|||
|
--nc, --no-clobber 跳过那些会下载到现有文件的下载(覆盖它们)
|
|||
|
--no-netrc 不要试图从 .netrc 中获取证书。
|
|||
|
-c, --continue 继续已部分下载的文件
|
|||
|
--start-pos=OFFSET 从 0 开始 OFFSET 位置开始下载
|
|||
|
--progress=TYPE 选择进度表类型
|
|||
|
--show-progress 在任何详细模式下显示进度条
|
|||
|
--N, --timestamping 不重新检索文件,除非比本地文件新。
|
|||
|
--no-if-modified-since 在时间戳模式下不使用条件性的 if-modified-since 获取请求
|
|||
|
--no-use-server-timestamps 不以服务器上的时间戳来设置本地文件的时间戳。
|
|||
|
--S, --server-response 打印服务器响应
|
|||
|
--spider 不下载任何东西
|
|||
|
-T, --timeout=SECONDS 设置所有的超时值为 SECONDS
|
|||
|
--dns-timeout=SECS 将 DNS 查询超时设置为 SECS
|
|||
|
--connect-timeout=SECS 将连接超时设置为 SECS
|
|||
|
--read-timeout=SECS 设置读取超时为 SECS
|
|||
|
--w, --wait=SECONDS 在两次检索之间等待 SECONDS(适用于检索的 URL 超过 1个)。
|
|||
|
--wait retry=SECONDS 在检索的重试之间等待1...SECONDS(适用于检索的 URL 超过 1 个)。
|
|||
|
--random-wait 在两次检索之间等待 0.5WAIT...1.5WAIT 秒(适用于检索的 URL 超过 1 个)
|
|||
|
```
|
|||
|
|
|||
|
### 总结
|
|||
|
|
|||
|
我希望这个指南能帮助你解决 Linux 发行版中的 wget 错误。明显的方案是非常简单的。
|
|||
|
|
|||
|
如果有帮助或者你有任何问题,请在下面留言。
|
|||
|
|
|||
|
[参考][3]
|
|||
|
|
|||
|
--------------------------------------------------------------------------------
|
|||
|
|
|||
|
via: https://www.debugpoint.com/wget-not-found-error/
|
|||
|
|
|||
|
作者:[Arindam][a]
|
|||
|
选题:[lkxed][b]
|
|||
|
译者:[geekpi](https://github.com/geekpi)
|
|||
|
校对:[校对者ID](https://github.com/校对者ID)
|
|||
|
|
|||
|
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
|||
|
|
|||
|
[a]: https://www.debugpoint.com/author/admin1/
|
|||
|
[b]: https://github.com/lkxed
|
|||
|
[1]: https://www.debugpoint.com/category/distributions
|
|||
|
[2]: https://www.debugpoint.com/wp-content/uploads/2022/09/Sample-example-of-how-to-use-wget.jpg
|
|||
|
[3]: https://www.gnu.org/software/wget/
|