如何将 wget 或 curl 终端输出保存到文件

How to save wget or curl terminal output to file

我想问一下如何保存正在写入终端的 wget 或 curl 输出。 例如:

wget -O - "some file im downloading"

现在终端会显示下载了多少文件,当前下载速度是多少。 所以我想知道如何将所有这些变化的值保存到一个文件中

wget 的状态信息总是打印到 stderr(通道 2)。所以你可以将该频道重定向到一个文件:

wget -O - "some file im downloading" >downloaded_file 2>wget_status_info_file

通道 1 (stdout) 被重定向到文件 downloaded_file,stderr 被重定向到 wget_status_info_file