Search code examples
bashngrep

How can I redirect ngrep output to file


I am running ngrep on machine to listen to request and response. How can I redirect its output to a file?

I am doing something like this:-

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

But when I am doing tail -f ngrep_output.txt on other screen, I can't see anything.

Once I kill the above process then only I could see the contents in file.

So, it looks like it keeps the result in buffer somewhere? Is there a way I could redirect my output in realtime to the file?


Solution

  • There doesn't seem to be any document describing the commandline arguments to ngrep, but the source code indicates that the -l option turns off output buffering.