The netstat command generates displays that show network status and protocol statistics. It is a cross-platform utility available for Linux, macOS, or Windows systems. Which is very helpful troubleshooting the network configuration and issues. Identifying the application using ports on a system.

Advertisement

The latest Linux operating systems have default installed this tool. But some of the minimal installation may not contain this tool in your system. In that case, this tutorial will help you to install netstat command on Linux system.

How to Install netstat Command in Linux

Generally the net-tools package provides the netstat command for most of the popular Linux distributions. Use one of the below command to install the netstat command on your system.

  • Install netstat on Fedora & CentOS/RHEL 8 systems: Use dnf command line package manager to install netstat from default package repositories.
    sudo dnf install net-tools 
    
  • Install netstat onn CentOS/RHEL 7 systems: For older version of Redhat based systems, use yum package manager to install netstat tool.
    sudo yum install net-tools 
    
  • How to Install netstat on Debian/Ubuntu: Use apt package manager to install netstat on Ubuntu and Debian systems form official repositories.
    sudo apt update && sudo apt install net-tools 
    
  • Install netstat on Arch systems:
    sudo pacman -S netstat-nat 
    
  • Install netstat on OpenSuse:
    sudo zypper install net-tools 
    

Using netstat Command in Linux

Netstat is a widely used command line utility for printing network connections, routing table, interfaces and interfaces statistics. Personally, I use this command for displaying PID/Program name for socket or listening server sockets on a systems.

My frequently used command is:

netstat -tulpn 

The above command help me find services running on various ports. With this its easier to identify if any service is listing on any port or not. The command parameters are:

  • -t – is used to print TCP connections
  • -u – is used to print UDP connections
  • -l – Print all listening server sockets
  • -p – Print all PID/Program name for sockets
  • -n – Don’t resolve names from IPs

Conclusion

This tutorial describes you to how to install missing netstat command on your Linux system. Additionally shared my favorite use case of the netstat command.

Share.
Leave A Reply


Exit mobile version