Explore our new Cybersecurity Terms Glossary, explained by our experts.

View the Glossary View the Glossary
PRIVIA

Cybersecurity Terms Glossary

What Is tcpdump?

tcpdump captures and displays network packets from the command line, using Berkeley Packet Filter expressions to select exactly the traffic an engineer needs to see.

Illustration for the cybersecurity term tcpdump
Home / Blog / Cybersecurity Terms / What Is tcpdump?
17 November 2026

What Is tcpdump?

What Is tcpdump?

tcpdump reads packets off a network interface and prints them, or writes them to a file for later analysis. It has been doing this since 1988, when it was written at the Lawrence Berkeley National Laboratory, and the packet capture library it spawned, libpcap, underpins most of the tools that followed. On any Unix-like system, it is the fastest route from “the network is behaving strangely” to actual evidence.

Its value today is partly that it is already installed. When you are on a production server at two in the morning, a single-binary tool with no graphical interface and no dependencies is exactly what you want.

The Filter Language Is the Tool

Capturing everything on a busy interface produces a file nobody can use. Berkeley Packet Filter expressions solve that by selecting traffic in the kernel before it ever reaches the application, which keeps overhead low even on loaded systems.

ExpressionSelects
host 10.0.4.19Traffic to or from one address
net 192.168.20.0/24A whole subnet
port 443One service port, either direction
tcp and not port 22TCP, excluding your own session
tcp[tcpflags] & tcp-syn != 0Connection attempts, for spotting scans
vlan and host 10.2.0.5Traffic inside a tagged VLAN

That last point catches people out: on a trunk port, filters fail silently unless the expression accounts for the VLAN tag, because the offsets of everything after it shift.

Options Worth Memorising

A handful of flags cover most work. -i selects the interface, and -i any captures across all of them on Linux. -n suppresses name resolution, which stops the tool generating DNS traffic of its own while you are trying to analyse DNS traffic. -w writes a pcap file and -r reads one back. -c stops after a number of packets, and -G with -W rotates files on a time interval so a long capture does not fill the disk.

For sustained capture, rotation plus a size limit is the difference between useful evidence and an outage caused by a full filesystem. Run the capture under a dedicated account with -Z, or grant the binary only the network capture capability rather than full root, because packet parsers have a long history of vulnerabilities and the parsing happens on data an attacker controls.

Working with Wireshark

The normal division of labour is capture on the server with tcpdump, analysis on a workstation with Wireshark. The file format is the same, so a capture taken with -w opens directly. This avoids installing a graphical application on a production host and avoids the temptation to run a heavyweight dissector as root on live traffic.

Two details matter when handing files over. Use a sufficient snap length so packets are not truncated, which modern versions default to. And record the capture point, interface, and time zone alongside the file, because a packet capture with no context is difficult to interpret and useless as evidence.

Security Uses

In incident response, tcpdump answers questions no log can: what exactly did this host send, to where, and when. Capturing traffic from a suspect machine confirms beaconing intervals, reveals the destinations behind a command and control channel, and shows whether data left in volume. In testing, it verifies that traffic takes the path you believe it takes, which routinely disproves assumptions about segmentation and proxy enforcement.

It is also a diagnostic for other tools: when a scan returns nothing, a capture shows whether packets left the interface at all. Full-content capture complements Zeek and Suricata, which summarise continuously but rarely retain payloads.

Legal and Privacy Obligations

Packet capture on a corporate network is lawful when done by the operator for security and network management, but it is not unconstrained. A full-content capture will contain personal data: email content, form submissions, authentication material, and browsing activity. Under UK GDPR that makes it personal data processing, requiring a lawful basis, a defined retention period, access restrictions, and inclusion in your records of processing. Interception of communications is also regulated under the Investigatory Powers Act 2016, and the operator exemption depends on the purpose.

The practical controls are straightforward: filter narrowly rather than capturing everything, prefer headers over payloads where the question allows it, store capture files encrypted with restricted access, delete them when the investigation closes, and tell employees in the acceptable use policy that monitoring takes place.

Our Investigation and Incident Response Services handle capture and analysis under documented evidence procedures when an incident needs that level of detail.

FAQ – Frequently Asked Questions

What Is the Difference Between tcpdump and Wireshark?

tcpdump is a lightweight command-line capture tool, ideal on servers and remote systems where no graphical interface exists. Wireshark provides deep protocol dissection, stream reassembly, and visual analysis. They share the same capture format, so the usual pattern is to capture with tcpdump and transfer the file to a workstation running Wireshark.

Does tcpdump Need Root Privileges?

It needs permission to open a raw socket, which traditionally meant root. On Linux, granting the binary the network raw and admin capabilities is better practice, and the -Z option drops privileges to an unprivileged user after the capture begins. This matters because packet parsers handle attacker-controlled data and have had exploitable vulnerabilities.

Can tcpdump Read Encrypted Traffic?

No. It captures what crosses the wire, so TLS-protected payloads appear as ciphertext. The visible metadata is still useful: addresses, ports, packet sizes, timing, the server name in the TLS handshake, and certificate details. For payload visibility you need the session keys or a decrypting proxy, which raises its own privacy and governance questions.

How Do I Capture Without Filling the Disk?

Use rotation. The -G option starts a new file at a time interval, -C rotates by file size, and -W limits how many files are kept before the oldest is overwritten. Combine that with a tight filter expression so only relevant traffic is written, and monitor free space, since a full filesystem on a production server causes its own incident.

Related Terms

You May Be Interested In These

What Is a Rowhammer Attack?

Cybersecurity Terms

17 November 2026

What Is a Rowhammer Attack?

Read More
What Is SaaS Security Posture Management?

Cybersecurity Terms

17 November 2026

What Is SaaS Security Posture Management?

Read More
What Is DOM-Based XSS?

Cybersecurity Terms

17 November 2026

What Is DOM-Based XSS?

Read More