Useful TCPDUMP Commands for Packet Sniffer On CentOS 7

Useful TCPDUMP Commands line interface where we can capture or analyze the packets or sniff them over the network. We can install tcpdump and we have provided you the few examples of tcpdump commands in Linux.

This is widely used and the most important commands in the Linux environment.

Check Out: How To Install OpenShot Video Editor On Ubuntu 20.04

Useful TCPDUMP Commands for Packet Sniffer:

Tcpdump works on the network layer and installed in the Linux machine if not you can install it either by downloading from the official site or via yum install tcpdump.

If tcpdump command not found. you can install it using yum install tcpdump

Check installed or not

rpm –qa | grep tcpdump

use of tcpdump command in linux

  1. With –i options

That’s used to specify the interfaces with the help of you can capture the packets from a particular interface.

tcpdump –i ens33

Check Out: How To Enable Haproxy Stats With GUI View On Linux

  1. With –D options. This used to see all the available interfaces in the Linux machine.
    tcpdump –D

  1. With –n options. If you use –n options with tcpdump command, it will show you sender and receiver packets with IP address otherwise with Name format.

  1. With –c options. That’s used to see a number of packets need to be captured.

Check Out: How To Install Java Using Apt-Get Command In Ubuntu

  1. With –s options. A tcpdump captured 96bytes, By default if what you want to capture more than this or full TCP packets so you will have to specify the size. You can use –s0 to capture all packets.

More Commands:

  1. With –e options. Print the link-level header on each dump line, this is to print MAC layer addresses for protocols.

  1. With –w options. This used to capture the output and save it in a file.

Useful TCPDUMP Commands

Check Out: How To Increase Size of Volume On Amazon Cloud

  1. With –r options. If you want to read the file which you have saved, you will have to use ‘–r’ to options to read packets.


  1. For a particular port If you want to capture the packet with the particular port number, it’s possible.
    tcpdump –c 5 –i ens33 port 80

tcpdump command in linux

In case you do not need to capture a packet from a particular port you can exclude them.

tcpdump –c 5 –i ens33 ‘ port !80’
  1. Capture packet towards a particular hosts
tcpdump –i ens33 –c 5 src host

Check Out: Docker Connection Error Desc Transport X509 Certificate


tcpdump –i ens33 –c 5 dst host
  1. Filter with protocol
tcpdump –i ens33 icmp

 example of tcpdump

That’s it. example of tcpdump commands in linux

Share on:

I'm the founder of Curious Viral. I hope this blog will provide you complete information about Linux Technology & I would like to share my technical knowledge with you which I have learned during this period.

Other Posts You May Like...

Leave a comment