【问题标题】:How can I redirect ngrep output to file如何将 ngrep 输出重定向到文件
【发布时间】:2017-10-26 20:07:18
【问题描述】:

我在机器上运行 ngrep 来监听请求和响应。如何将其输出重定向到文件?

我正在做这样的事情:-

sudo ngrep -q -t "/dummy/v1/xyz" -W byline -d any port 1231  > ngrep_output.txt

但是当我在其他屏幕上做tail -f ngrep_output.txt 时,我什么都看不到。

一旦我终止了上述进程,那么只有我可以看到文件中的内容。

那么,看起来它会将结果保存在缓冲区中的某个地方?有没有办法可以将我的输出实时重定向到文件?

【问题讨论】:

  • 这个我没试过,但是看源码你可以试试not specify -q或者指定-l。
  • 是的 -l 工作。谢谢。如果你愿意,你可以把它放在答案中。我可以接受。

标签: bash ngrep


【解决方案1】:

似乎没有任何文档描述 ngrep 的命令行参数,而是 the source code indicates that the -l option turns off output buffering。

【讨论】:

    猜你喜欢
    • 2019-01-05
    • 1970-01-01
    • 1970-01-01
    • 2010-09-29
    • 2012-06-26
    • 2017-04-04
    • 2012-01-11
    • 2011-11-01
    • 2018-05-02
    相关资源
    最近更新 更多