linux - 在 Linux 终端中,破折号是否可以用作临时文件名?

标签 linux terminal nmap

我是 Linux 新手,我正在学习 nmap,我对破折号有疑问,我在教程中看到一行命令是

nmap -oG - 1.2.3.4 -p 22 -vv > /home/TEST

我的问题是在 -oG 之后选项需要一个文件名,但如果使用破折号作为选项的文件名,为什么可以跳过它?是因为破折号是临时文件或其他东西的意思吗?它也不会在/home/目录中创建名为“-”的文件。

最佳答案

它表示 stdout,在您的示例中为 /home/TEST。你也可以只使用:

nmap -oG /home/TEST 1.2.3.4 -p 22 -vv

来自 man nmap (部分“输出”):

... While these options save results to files, Nmap still prints interactive output to stdout as usual. For example, the command nmap -oX myscan.xml target prints XML to myscan.xml and fills standard output with the same interactive results it would have printed if -oX wasn't specified at all. You can change this by passing a hyphen character as the argument to one of the format types. This causes Nmap to deactivate interactive output, and instead print results in the format you specified to the standard output stream. So the command nmap -oX - target will send only XML output to stdout.. Serious errors may still be printed to the normal error stream, stderr. ...

关于linux - 在 Linux 终端中,破折号是否可以用作临时文件名?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53379828/

相关文章:

ruby - 通过 Travis CI 在 Matrix 中使用带有 Ruby 和 Shell 的多个操作系统

linux - 从伪 tty 中分离一个 linux 进程,但保持 tty 运行?

c - 如何在终端上显示 Xcode 输出?

c++ - 关于如何以编程方式与 nmap 集成的任何想法?

java - 如何使用java中的解析器从nmap XML字符串(IP,端口)获取信息

Linux 二进制权限

linux - 在 windows 和 linux 上都会成功的命令,但会给出不同的结果

linux - 使用 Qt 查找 Linux 机器上安装了哪个编辑器

linux - 如果命令超过 1 行,如何在 shell 或 bash 中输入新行/移动到下一行而不执行命令?

java - nmap 无法找到 nmap 服务