Network

The tcpdump command

Captures the network traffic passing through an interface, to troubleshoot or study protocols.

Syntax

sudo tcpdump [-i interfaz] [-c N] [filtro]

Most useful options

-iInterface to listen on
-c NStops after capturing N packets
port 80Filters by port

Copy-ready examples

$ sudo tcpdump -c 3Capture 3 packets

You can try them in the browser terminal: it does not touch your computer.

Typical mistakes

  • Without -c it keeps capturing until you stop it with Ctrl+C.

Related commands

FAQ

Do I need sudo?

Usually yes, because it accesses the network card directly.

Learn to actually use it

The basic Linux course takes you from zero to console fluency with 24 self-grading lessons.

Start the free course