wget -qO- 127.0.0.1是什么意思?


9

我已经尝试使用Google搜索一个小时了,但仍然没有运气。有人知道这个命令的意思吗?

wget -qO- 127.0.0.1

我知道wget是Linux的“ web get”实用程序,并且127.0.0.1是localhost。我不知道是什么-qO-意思?

我还相信以上内容与wget -q -O 127.0.0.1从终端中的简单运行给我不同的结果有所不同。

注意:我正在尝试从此Vagrant-Getting Started Tutorial中了解此命令。

提前谢谢了。


实际上,另一个在“ wget qO”上的Google搜索(这次没有破折号)给了我这个建议该命令的论坛:将HTML内容(在这种情况下为127.0.0.1)打印到终端屏幕上。但是在哪里可以找到有关-something-语法的更多信息?(即option关键字左右两侧的一个破折号)。
Atlas7'8

2
看来我还没有完成足够的研究。我刚发现这个论坛似乎只是在解释-O-语法(将输出结果指向终端)。加上此Linux wget文档说:(if the file is -, the documents will be written to standard output.即第二个破折号表示“到标准输出” ...因此,在这一点上,我只能假定此“闭合破折号”语法仅适用于wget -O选项(一般来说不适用于Linux?) 。
Atlas7

Answers:


11

您的search-foo不完整。试试看man 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.

       For this reason, -N (for timestamp-checking) is not supported in combination with -O: since file is always newly created, it will
       always have a very new timestamp. A warning will be issued if this combination is used.

       Similarly, using -r or -p with -O may not work as you expect: Wget won't just download the first file to file and then download the
       rest to their normal names: all downloaded content will be placed in file. This was disabled in version 1.11, but has been reinstated
       (with a warning) in 1.11.2, as there are some cases where this behavior can actually have some use.

       Note that a combination with -k is only permitted when downloading a single document, as in that case it will just convert all relative
       URIs to external ones; -k makes no sense for multiple URIs when they're all being downloaded to a single file; -k can be used only when
       the output is a regular file.

   -q
   --quiet
       Turn off Wget's output.

1
谢谢!man wget现在查找可以清除更多内容!(我完全忘记了该man实用程序-我过分依赖Google。这对我来说是个警钟。)我还确认该命令与wget -q -O- 127.0.0.1或相同wget -q -O - 127.0.0.1-现在以这种语法查看命令似乎对我来说“更有意义”。再次感谢。
Atlas7

7

对于此类问题,如果附近有浏览器,可能会发现使用explainshell.com很方便(因为手册页可能很长才能找到您感兴趣的参数):

在此处输入图片说明


在手册页中查找信息一点也不难,我使用less的搜索功能(/-O)在3次击键中找到了这些信息。
Doorknob

@Doorknob当然可以,但是您必须查找每个未知的参数。
Franck Dernoncourt,2015年

大份额。使用该工具时是否有可能引起注意的“故障”?
2015年

@ Atlas7我并不知道。
Franck Dernoncourt,2015年
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.