我在机器上运行ngrep来收听请求和响应。如何将其输出重定向到文件?
我正在做这样的事情: -
sudo ngrep -q -t "/dummy/v1/xyz" -W byline -d any port 1231 > ngrep_output.txt
但是当我在其他屏幕上进行tail -f ngrep_output.txt
时,我看不到任何东西。
一旦我杀了上面的过程,那么我才能看到文件中的内容。
所以,看起来它将结果保存在缓冲区中?有没有办法可以将我的输出实时重定向到文件?
答案 0 :(得分:1)
似乎没有任何文档描述ngrep的命令行参数,但是the source code indicates that the -l
option turns off output buffering。