The netstat command is a very useful tool used by Linux system administrators. It helps find important information about the network configuration, which process is bound to a specific port, and more. In recent years some distros have been replacing netstat with the ss command. However, if you are like me and are used to netstat, you may want to install it. In this Linux quick tip we will show you how to install netstat on your favorite flavor of Linux.

The net-tools package provides the netstat command. Read below to learn how to install the netstat command on your system.

Install Netstat on Red Hat 7 or CentOS 7

Red Hat and similar distros use YUM package manager. Issue the following command to install the net-tools package and get access to the netstat command.

sudo yum install net-tools

Install Netstat on Red Hat 8 or CentOS 8

Red Hat 8 and similar distros switched to DNF for the package manager. Although it is backward compatible with YUM, you should still start using DNF. Here is how to install it with DNF.

sudo dnf install net-tools

Install Netstat on Debian or Ubuntu

In Ubuntu/Debian based systems you need to use the APT package manager. Preferably you should update your repositories before installing new software. Here are the commands you need to update your repos and install the net-tools package.

sudo apt update; sudo apt install net-tools

Install Netstat on Arch Linux

You guessed it, Arch uses a completely different package manager called pacman. Here we will us pacman with the -S (sync) option to synchronize the packages and install netstat.

sudo pacman -S netstat-nat

Install Netstat on OpenSuse

Yep, Opensuse uses yet another package manager called zypper. This is basically the same command, just using a different package manager.

sudo zypper install net-tools

Conclusion

That's it, you should now be comfortable installing the netstat utility on your Linux system.