How can i see packets while capturing with tcpdump
Solution 1:
So after a bit of experiment, the anwser if the following :
sudo tcpdump -i enp2s0 -U -w - | tee test.pcap | tcpdump -r -
-w -
: write to standard output.
-U
: write packets as soon as they arrive. Don't wait until the buffer is full.
Tee
will write to the file, and tcpdump -r -
read the packets from standard input.
Solution 2:
-w
option is to write the tcpdump output to a file. you can remove that option if you want to print on your terminal.