22 C
Texas
angeloma
Senior Writer and partner

How to install the netstat command on Linux?

Hello, friends. In this post, we will show you how to install the Netstat command with which we can quickly monitor our network information. The post will be approached from the terminal and covering most Linux distributions or at least the most popular ones.

Netstat is a tool that we can use through the command line. It allows us to monitor networks and also to troubleshoot certain problems that may arise. Also, it is widely used to identify the TCP connections that are active on the machine on which the command is executed.

All this, we emit an output screen where we can visualize the network information or even export it through the use of commands.

This tool is quite useful for the more technical Linux users because it allows us to quickly analyze and detect possible problems that are happening in our network. Even more, to make an analysis on it.

- Advertisement -

Despite being so popular, it is not included in most Linux distributions and that is why in this post, we will help you how to install it.

So, let’s start.

Install the Netstat on Linux command

As we said, being such a popular tool, it is hard to believe that it is not included in the existing Linux distributions.

The solution to this is to install via official repositories, the net-tools package in order to add the command but also other important tools.

So, in the case of Debian, Ubuntu, Linux Mint, ElementaryOS, and any distribution based on any of these, just open the terminal and execute

sudo apt update
sudo apt install net-tools

In case you are using, Fedora 34, RockyLinux, AlmaLinux OS, RHEL 8, CentOS 8, Oracle Linux 8, or any distribution based on these.

sudo dnf install net-tools

But, if you are using older versions such as RHEL 7, CentOS 7, Oracle Linux 7, or any of their derivatives, then you will need to run

sudo yum install net-tools

A very popular distribution among Linux users is Arch Linux. It also has some derivatives such as Manjaro. For these distributions or any derivative of them, just run:

sudo pacman -S netstat-nat

As we all know, one of our favorite distributions is OpenSUSE, so we can’t leave it out.

So, to install it on OpenSUSE

sudo zypper in net-tools

This way we will be able to use it from the terminal without problems.

Using the Netstat command

It is normal to use the command directly on the terminal. And there it will show much of the default information of the active network interface.

Another common use is to run it together with some other options, for example:

netstat -tulpn

For more complex use of this command, we have prepared a post on the use of Netstat where you can find use cases.

Monitor Network with netstat command in Linux

So, enjoy it.

Conclusion

These types of commands can be useful in our work where many tools are required to help with network control. Although there are more specialized and larger tools, it is also true that sometimes we just need a little help.

- Advertisement -
Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"

LEAVE A REPLY

Please enter your comment!
Please enter your name here



Latest article