How to Install or Uninstall tcpdump on Ubuntu 22.04

Updated: September 22, 2022

This program allows you to dump the traffic on a network. tcpdump is able to examine IPv4, ICMPv4, IPv6, ICMPv6, UDP, TCP, SNMP, AFS BGP, RIP, PIM, DVMRP, IGMP, SMB, OSPF, NFS and many other packet types. I will show you how to install tcpdump on Ubuntu 22.04 in this tutorial.

Requirements

  • OS: Ubuntu 22.04 is needed for tcpdump to work
  • Privileges: Verify that you can execute the sudo commands line.

Prerequisites to install tcpdump on Ubuntu 22.04

Install tcpdump Ubuntu 22.04

tcpdump is one of the popular ways on Ubuntu now so that this tutorial will show you some ways to install it. Choose the one you believe is simple and easy to follow.

Install tcpdump using APT

This is a popular method for installing any Ubuntu packages because it is simple to understand, even if you are a Linux beginner. Following these instructions to get tcpdump on your Ubuntu.

Step 1: The APT package repository cache needs to be updated before you try to install, update, or remove any packages. Update the APT database to download new packages from Ubuntu. Opening the terminal and executing this Linux command:

sudo apt update

Step 2: Install the package on Ubuntu 22.04. After updating the system, you can install tcpdump Ubuntu by executing this command in the terminal.

sudo apt-get -y install tcpdump

Install tcpdump using Aptitude

Aptitude allows users to view a list of available packages and manage package installation, upgrade, and removal. If you haven’t already done so, run this command to install it.

sudo apt-get -y install aptitude

After installing aptitude, you can now install tcpdump, just following these steps:

Step 1: You must update the APT package repository cache before attempting to install, update, or remove any packages. Update the APT database to download new packages from Ubuntu. Opening the terminal and executing this Linux command:

sudo apt-get update

Step 2: Start the package installation on Ubuntu 22.04. After updating, you can install tcpdump Ubuntu by pasting this command into the terminal and pressing Enter.

sudo aptitude -y install tcpdump

Uninstall tcpdump on Ubuntu 22.04

Have you ever considered how difficult it is to uninstall an application from Ubuntu? You are mistaken; anyone, not just package administrators, can easily uninstall any program.

You can uninstall tcpdump on Ubuntu by running this command if you installed it using APT or Aptitude.

sudo apt remove --auto-remove tcpdump

To uninstall tcpdump and remove its data and dependencies, you can also use the following command:

sudo apt autoremove --purge tcpdump

Conclusion

In this guide, I showed you ways to install tcpdump on Ubuntu 22.04 and some ways to uninstall tcpdump too. If you need any help, don’t hesitate to contact me. I’m very glad to answer them.