This is our old Q&A Site. Please post any new questions and answers at

When we use tcpdump, we see like the following at the end - is there any way to write only the packets captured to a file using the -w option (in this case save only 1310)? I want to do my analysis on the captured packets.

I am using this command

> sudo tcpdump -vv -s0 -i enp0s8 tcp and port 5201
1310 packets captured
133919 packets received by filter
132609 packets dropped by kernel

asked 14 May '17, 10:39

armodes's gravatar image

accept rate: 0%

edited 14 May '17, 13:13

grahamb's gravatar image

grahamb ♦

That looks like your machine is simply too slow to write all packets to disk, or even get all of them from the network card into memory. You need a much much much faster capture machine :-)

permanent link

answered 14 May '17, 11:27

Jasper's gravatar image

Jasper ♦♦
accept rate: 18%

OK, in that case i will change a machine.

(14 May '17, 13:39) armodes

Note also that, in that example, tcpdump ''isn't'' writing packets to disk; the -w flag isn't being used, and the standard output isn't being redirected to a file. (Presumably it ''did'' print all 1310 packets before printing the captured/received/dropped message.)

Furthermore, tcpdump is dissecting the packets (because it's being run without -w), and that takes additional CPU time - and you're not running it with -n, so it's also trying to look up the source and destination IP addresses for the packets and report them as domain names, which can slow things down further.

(14 May '17, 19:18) Guy Harris ♦♦
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 14 May '17, 10:39

question was seen: 1,796 times

last updated: 14 May '17, 19:18

p​o​w​e​r​e​d by O​S​Q​A