我正在尝试将 dropbox 安装到我的 Debian 机器上,我看到了说明
cd ~ && wget -O - "some website leading to the download of a tar file" | tar xzf -
Run Code Online (Sandbox Code Playgroud)
但我所做的只是输入:
wget -O - "some website leading to the download of a tar file"
Run Code Online (Sandbox Code Playgroud)
我的终端上有很多垃圾。是什么 wget -O -
意思?它对我的电脑有什么危害吗?
查看wget
.
-O file
--output-document=file
The documents will not be written to the appropriate files, but all
will be concatenated together and written to file. If - is used as
file, documents will be printed to standard output, disabling link
conversion. (Use ./- to print to a file literally named -.)
Use of -O is not intended to mean simply "use the name file instead
of the one in the URL;" rather, it is analogous to shell redirection:
wget -O file http://foo is intended to work like
wget -O - http://foo > file; file will be truncated immediately, and
all downloaded content will be written there.
Run Code Online (Sandbox Code Playgroud)
因此,您可以使用将“URL”的内容下载到文件中-O somefile
,也可以下载它并通过 STDOUT 将其内容重定向到另一个工具以对其进行处理。在这种情况下,这就是他们对| tar xvf -
.
你的命令:
$ cd ~ && wget -O - "some website leading to the download of a tar file" | tar xzf -
Run Code Online (Sandbox Code Playgroud)
上面是从“URL”中获取 tarball,当它被下载时,它被重定向到命令,tar
以便它可以解压缩到你的文件系统中。