tcpdump: command not found. Install tcpdump on CentOS

tcpdump: command not found. Install tcpdump on CentOS 7 / RHEL 7 server

Follow the below steps to install tcpdump on CentOS7 / RHEL 7 server.


-bash: tcpdump: command not found


root@server [~]# tcpdump -i eth0
-bash: tcpdump: command not found

Tcpdump command is used on Linux servers to capture and analyze network traffic. I got the above error while trying to execute tcpdump command on my Linux server.

On CentOS and Redhat servers, tcpdump command is provided by tcpdump package.

1. Log into your CentOS server as ‘root’ user

2. Run rpm query all command to check whether tcpdump package is installed or not

Command to check whether tcpdump package is installed on your server:

root@server [~]# rpm -qa | grep tcpdump
root@server [~]#

Tcpdump package is not installed on the above server.

3. You can install tcpdump command using yum.

Command to Install tcpdump package on Linux Server : Yum install tcpdump

# yum install tcpdump
Loaded plugins: fastestmirror, ovl
Determining fastest mirrors

Resolving Dependencies
--> Running transaction check
---> Package tcpdump.x86_64 14:4.9.2-4.el7_7.1 will be installed
--> Processing Dependency: libpcap >= 14:1.5.3-10 for package: 14:tcpdump-4.9.2-4.el7_7.1.x86_64
--> Processing Dependency: for package: 14:tcpdump-4.9.2-4.el7_7.1.x86_64
--> Running transaction check
---> Package libpcap.x86_64 14:1.5.3-12.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

Package Arch Version Repository Size
tcpdump x86_64 14:4.9.2-4.el7_7.1 base 422 k
Installing for dependencies:
libpcap x86_64 14:1.5.3-12.el7 base 139 k

Transaction Summary
Install 1 Package (+1 Dependent package)

Total download size: 560 k
Installed size: 1.3 M
Is this ok [y/d/N]: y
Downloading packages:
warning: /var/cache/yum/x86_64/7/base/packages/libpcap-1.5.3-12.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY ] 0.0 B/s | 0 B --:--:-- ETA
Public key for libpcap-1.5.3-12.el7.x86_64.rpm is not installed
(1/2): libpcap-1.5.3-12.el7.x86_64.rpm | 139 kB 00:00:00
(2/2): tcpdump-4.9.2-4.el7_7.1.x86_64.rpm | 422 kB 00:00:00
Total 548 kB/s | 560 kB 00:00:01
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : 14:libpcap-1.5.3-12.el7.x86_64 1/2
Installing : 14:tcpdump-4.9.2-4.el7_7.1.x86_64 2/2
Verifying : 14:libpcap-1.5.3-12.el7.x86_64 1/2
Verifying : 14:tcpdump-4.9.2-4.el7_7.1.x86_64 2/2

tcpdump.x86_64 14:4.9.2-4.el7_7.1

Dependency Installed:
libpcap.x86_64 14:1.5.3-12.el7

tcpdump package and libpcap dependency is installed.

How to download and install tcpdump rpm on CentOS7 / Redhat 7 server

1. Log into your Linux server as ‘root’ user

2. Download tcpdump package from centos website using wget command

# wget

3. Install the rpm file either using yum or rpm command

# yum install tcpdump-4.9.2-4.el7_7.1.x86_64.rpm

yum command will download and install tcpdump and the required dependencies.

#rpm -ivh tcpdump-4.9.2-4.el7_7.1.x86_64.rpm

If you’re using rpm command, you must first download and install the required dependencies (only if the below dependencies are not installed). The below dependencies are needed.