tcpdump停止后只显示输出

我试图看看是否通过一个接口得到ping包,但tcpdump什么也没有显示。 但是,只要我停止它(Ctrl + C),所有的数据包出现,总结看起来不错。

例如:

11:49:45.486887 IP 11.0.0.1 > 11.0.0.9: ICMP echo reply, id 13532, seq 1, length 64 

这里的总结:

 10 packets captured 10 packets received by filter 0 packets dropped by kernel 

我通常看到交通“活”,但我不明白为什么现在它是隐藏的,直到我停止tcpdump。 有人可以指出我可能会发生什么?

您可能需要-l-U选项。 查看手册页中的信息…

  -l Make stdout line buffered. Useful if you want to see the data while capturing it. ... -U is similar to -l in its behavior, but it will cause output to be ``packet-buffered'', so that the output is written to stdout at the end of each packet rather than at the end of each line;