This is a static archive of our old Q&A Site. Please post any new questions and answers at ask.wireshark.org.

Capture Filter, TCP port only using tshark, is my command syntax correct?

0

Hi There, I'm new to tshark, and I want to run some tests before I give it a go on our live server.

I want to catch all packets on a single tcp port number, save them over ten files each with a size of 1KB.

I've tried the following command:

tshark -p -n -i eno1 -f "tcp port 40000" -a files:10 -b files:10 filesize:1024 -w /var/log/tshark/tcpds

It appears to work, I get the following response:

tshark: A capture filter was specified both with "-f" and with additional command-line arguments.

But nothing is being saved at the location specified. I've tried it both with and without sudo, the response is the same. What am I doing wrong?

asked 22 Apr '16, 01:39

elektrovert's gravatar image

elektrovert
21448
accept rate: 0%


One Answer:

1

Your second option for the -b parameter (filesize:1024) also needs a preceding -b, i.e.

tshark -p -n -i eno1 -f "tcp port 40000" -a files:10 -b files:10 -b filesize:1024 -w /var/log/tshark/tcpds

answered 22 Apr '16, 03:34

grahamb's gravatar image

grahamb ♦
19.8k330206
accept rate: 22%

Thanks, I'll try that out!

(22 Apr '16, 04:46) elektrovert