In this article, we cover how to install netstat in Ubuntu and AlmaLinux. When you try to execute netstat along with relevant options. It may throw an error, bash: netstat: command not found. It shows that the relevant package isn’t installed in our Operating System.
We won’t go into the specifics of the command-line tool: netstat. Just that, the utility is a part of the package: net-tools. And, if it is not there in our system then it throws the above-mentioned error.
We cover netstat installation steps required for Ubuntu first. And, AlmaLinux in the next section.
Note: Following operations require Administrative rights. If you don’t have the necessary rights then contact your System Administrator for assistance.
Install netstat in Ubuntu
The package net-tools is a part of the standard Ubuntu repository. First update the repository. This can be done with the following command:
sudo apt update
We update repositories to ensure that we get the latest version of the package installed. Thereafter, to install the net-tools package:
sudo apt install net-tools
Install netstat in AlmaLinux
Again the utility is a part of the net-tools package. net-tools package is a part of the Baseos repository. So, issue the following command in the terminal to get netstat command-line utility:
# dnf install net-tools
Once you have installed the required package, try running the netstat command-line utility in the terminal. It should work this time around.
In conclusion, we have covered how to install netstat in Ubuntu and AlmaLinux here. When we tried to run the command-line utility it returned with an error, bash: netstat: command not found. Reason: package net-tools wasn’t installed.