What tcpdump and libpcap is

libpcap is a C library that opens a network interface, applies a capture filter inside the kernel and hands matching packets to a program. tcpdump is the command line program that uses it to print packets as text or write them to a file. Both come from The Tcpdump Group under the three-clause BSD licence. The pcap file that libpcap writes is the common currency of network forensics. Wireshark, NetworkMiner, Zeek, Arkime and most commercial sensors read it. At the time of checking the stable releases were tcpdump 4.99.7 and libpcap 1.10.7, both from September 2026, with libpcap 1.11.0 in testing. The group's own release notes list FreeBSD, illumos, Linux, macOS, NetBSD, OpenBSD, QNX, Solaris 11 and GNU/Hurd. Windows is not on that list.

During an incident tcpdump is often the only capture tool present on a Linux server or jump host. The responder chooses the interface, sets the snapshot length so whole packets are kept, writes a Berkeley Packet Filter expression to limit the capture to the hosts or ports of interest, turns off name resolution so the capture itself does not generate DNS traffic and writes to a file, rotating files by size or time for a long capture. The file is then read in Wireshark or another tool. Because tcpdump runs on the host being examined, running it changes that host, so the command used, the time and the account must go into the notes.

Primary applications

Where it is used

  • Capturing traffic on a server that has no graphical tools installed
  • Quick checks of what is passing an interface during an incident
  • Long captures with file rotation by size or time
  • Reading a saved capture inside a script to filter or split it
  • Teaching capture filter syntax, which Wireshark shares
  • Providing the capture library that other open source tools build on

Who uses it

  • Incident responders working on Linux and Unix systems
  • Network engineers and administrators
  • Network forensic analysts
  • Students learning capture fundamentals

Capabilities and limits

Major capabilities

  • Capture filters compiled into the kernel so unwanted packets are never copied
  • Writes the pcap file format read by every major analysis tool
  • Control of snapshot length, interface, buffer size and name resolution
  • File rotation by size or time with a file name pattern
  • Reads saved captures back and prints decoded headers for many protocols
  • Can drop privileges to an unprivileged account after opening the interface
  • libpcap gives programs in C, Python and other languages the same capture interface

Technical limitations

  • Text output only. Deep decoding and stream reconstruction belong to Wireshark or NetworkMiner
  • Running it on the evidence host alters the host and must be recorded
  • Packets dropped under load are counted but lost for ever
  • Capture needs root or specific capture privileges
  • Writes classic pcap. Per-interface metadata and comments of the pcapng format need other tools

Learning with DFRTI

Independent professional education covering the principles and workflows of tcpdump and libpcap. DFRTI is not a vendor training centre and its courses are not vendor certifications.

Courses that cover this tool

Product names and trademarks belong to their respective owners. DFRTI is an independent educational and research institute. Inclusion in this directory does not imply manufacturer endorsement, partnership or authorisation. Facts are checked against the manufacturer's public documentation on the date shown and may have changed since.

Go deeper with DFRTI

Free pages explain the ground. Structured courses, lab work and a mentor take you from knowing about it to doing it on a case.