Forrest logo
back to the tcpdump tool

tcpdump:tldr:52c23

tcpdump: Capture all traffic except traffic over port 22 and save to a dump file.
$ tcpdump -w ${dumpfile-pcap} port not ${22}
try on your machine

The command tcpdump -w ${dumpfile-pcap} port not ${22} is used to capture network traffic using the tcpdump utility, while excluding any traffic on port 22 (which is typically used for SSH communication).

Let's break down the command:

  • tcpdump is a widely used command-line packet analyzer tool for capturing and analyzing network traffic.
  • -w ${dumpfile-pcap} specifies the output file where the captured traffic will be saved. ${dumpfile-pcap} is a placeholder for the name of the file in the command, which can be replaced with the desired name or path.
  • port not ${22} is a filter expression used to define which network traffic to capture. In this case, it specifies that only traffic not using port 22 should be captured. Port 22 is commonly associated with SSH (Secure Shell) traffic, so by excluding it, the command captures all traffic except SSH.

By running this command, tcpdump will start capturing network traffic and write it to the specified file while not including any traffic on port 22 in the capture.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the tcpdump tool