Home » Git » Linux tcpdump command Help and Examples

Linux tcpdump command Help and Examples

Update on:
Jan 8, 2020

Tcpdump is an essential command-line utility for network packet analyzing; it displays TCP\IP and other transmitted network packets over the network, which are attached to the system on which UNIX/Linux command utility tcpdump has installed.

Tcpdump uses libpcap library, which helps to capture network packets which is available on all Linux/Unix distro.

Tcpdump command used to read the network packet’s data from a network interface. You can also use previously created packet files to read and analyze with tcpdump. You can use tcpdump command as a root user or a user with sudo privileges.

Here in this tutorial, we will discuss the uses of tcpdump command with installation and some of the basic examples.

Let’s start with the installation of the tcpdump tool.

Tcpdump Installation:

In most of the Linux distro tcpdump preinstalled but if it not installed in your system, you can install it in your system by using the following methods.

CentOS/RHEL

You can install tcpdump in CentOS/RHEL using the following command,

$ sudo yum install tcpdump

Fedora

On fedora, you should use below command to install tcpdump,

$ dnf install tcpdump

Ubuntu/Debian/Linux Mint

Similarly, you can use below command on Ubuntu or Debian or Linux Mint to install tcpdump,

$ apt-get install tcpdump

Now let’s go with tcpdump command examples.

Examples:

We will use below created file as an input for sample command

Example 1: Capture packets from all interface

Use command tcpdump to capture network package, as shown below:

# tcpdump

Example 2: Capture packets from a specific interface

You can use the “tcpdump” command with the option “-i” and interface name to capture the network package from specific interface.

# tcpdump -i eth0

Example 3: Check available interfaces

You can use the “tcpdump” command with the “-D” option to display available all interface in system, as shown below.

# tcpdump -D

Related Posts

The 30 most useful Linux commands

This article will introduce some practical and common Linux or Unix command , which is the Linux system administrators normally use the command . This article is not a complete list, but a brief list of commands that can be useful...

15 Practical examples of tcpdump command

15 Practical examples of tcpdump command

The tcpdump is the most essential and powerful command-line network packet sniffing tool. We use it to analyze network packets, capture or filter TCP/IP packets that transferred and received over the network on a specific network interface. It is available in almost...

15 Useful “df” Commands to Check Disk Space in Linux

15 Useful “df” Commands to Check Disk Space in Linux

There are several Linux tools available on the internet to check disk space utilization; we can use any of them. But, Linux has a best built-in command-line utility called “df”. The “df” is the short form of “disk filesystem”, we can get detailed information on used...

15 Practical examples of echo command

15 Practical examples of echo command

If you are writing a bash script, you know echo command very well. It is use to display text lines on an output screen or a file. The echo command is the most common command used by all Linux users, and it is built-in Linux command. echo command syntax: echo...

Follow Us

Our Communities

More on Linux Command

The Ultimate Managed Hosting Platform
Load WordPress Sites in as fast as 37ms!

0 Comments

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

nine − 8 =

Shares