How to install Netstat on CentOS 8
netstat is a command-line utility to view network connections information to/from the machine. With netstat command, you can see network connections, interface statistics, routing tables, masquerade connections, and multicast memberships.
Are you wondering? netstat command not found after the installation of Centos 8
bash: netstat: command not found
Install netstat Package
This post will help you to install the necessary packages for getting netstat command.
Let us see which package provides us with the netstat command
yum whatprovides netstat
Output:
From the above command, you could see that the net-tools package provides you netstat command. So, install the net-tools package using the yum command.
yum -y install net-tools
Output:
Important netstat Examples
Execute the netstat command to see whether the command is available on your machine or not.
The netstat command with no extra option will only display the listening sockets.
netstat
Use -a option with the netstat to display both listening and non-listening sockets.
netstat -a
Use -n option with the netstat to display IP address instead of hostname.
netstat -n
Use -t with -an to display all TCP connections.
netstat -ant
Use -u with -an to display all UDP connections.
netstat -anu
Use -p additionally to any of the above options to display the PID and name of the program to which each connection belongs.
netstat -anp
Use -nr option with netstat command to display route details.
netstat -nr
Conclusion
That’s All. You now have learned how to get back netstat command and use it on your CentOS 8