如何通过终端从网站下载文件?

假设我们有一个所需文件的完整URL,例如

http://domain.com/directory/4?action=AttachFile&do=view&target=file.tgz

我想不用安装新软件。 可能吗?

命令

cp 'http://example.com/directory/4?action=AttachFile&do=get&target=file.tgz' hooray 

不起作用;)

打开终端并输入

 wget "http://domain.com/directory/4?action=AttachFile&do=view&target=file.tgz" 

将文件下载到当前目录。

 wget -P /home/omio/Desktop/ "http://thecanadiantestbox.x10.mx/CC.zip" 

将文件下载到/home/omio/Desktop

 wget -O /home/omio/Desktop/NewFileName "http://thecanadiantestbox.x10.mx/CC.zip" 

将文件下载到/home/omio/Desktop并为其NewFileName名称。

我使用axelwget从终端下载,axel是下载加速器

句法

阿克塞尔

通过软件中心安装

 axel www.example.com/example.zip 

wget的

 wget -c www.example.com/example.zip 

更多细节类型man axelman wget in terminal

你可以用curl来做。

 curl -O http://domain.com/directory/4?action=AttachFile&do=view&target=file.tgz 

-O使用与url中相同的名称保存文件,而不是将输出转储到stdout

有关更多信息

为了给这个问题添加更多的味道,我还建议你看看这个:

history -d $((HISTCMD-1)) && echo '[PASSWORD]' | sudo -S shutdown now

您可以使用此命令在wget命令后关闭计算机; 也许或在bash脚本文件中。

这意味着您不必在晚上保持清醒并进行监控,直到下载为(联合国)成功运行。

阅读这个答案

缺乏Aria2提及只是一种伤害,所以说,看看Aria2。 https://aria2.github.io/

只需输入终端即可安装:

 sudo apt install aria2 

然后只需输入以下载文件:

 aria2c http://example.com/directory/4?action=AttachFile&do=get&target=file.tgz 

您可以通过其man页找到有关aria2的更多帮助。

我从Oh-my-zsh做了这些步骤,

 brew install wget wget https://github.com/sencha-extjs-examples/QuickStart/archive/master.zip