wget
是一个用于从 Web 服务器下载文件的常用命令行工具。下面是一些常用的 wget
使用方法:
基本语法
wget [选项] [URL]
常用选项:
-
-O, --output-document=FILE:将下载的内容保存到指定的文件。
wget -O filename.extension URL
-
-P, --directory-prefix=PREFIX:将下载的文件保存到指定的目录。
wget -P /path/to/directory URL
-
-c, --continue:继续下载之前中断的下载。
wget -c URL
-
-r, --recursive:递归下载,下载指定 URL 中的所有链接。
wget -r URL
-
-np, --no-parent:在递归下载时不进入上级目录。
wget -r -np URL
-
-nd, --no-directories:不创建目录结构,将所有文件下载到当前目录。
wget -nd URL
-
-i, --input-file=FILE:从文件中读取要下载的 URL 列表。
wget -i filena