How to install Netstat on CentOS 8
Netstat is a command-line utility to view network connection information to/from the machine. With the 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 the netstat command.
Let us see which package provides us with the netstat command
yum whatprovides netstat
Output:
From the above command, you can 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 the -n option with the netstat to display the IP address instead of the 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 the -nr option with the netstat command to display route details.
netstat -nr
Conclusion
That’s All. You now have learned how to get back the netstat command and use it on your CentOS 8