To find error bash: netstat: command not found, it means netstat not have into your Debian/Ubuntu Linux system, To fix this error, just simply open your command line and use sudo apt install net-tools
command into it, and press enter, it will fix this error in just 1 minute.
How To Fix bash: netstat: command not found error on Debian/Ubuntu Linux
A quick solution for this error is to install netstat command in Ubuntu/Debian Linux. Simply type the sudo apt install net-tools
command to install netstat tool on Linux Ubuntu/Debian Command line, and press enter:
sudo apt update sudo apt install net-tools
This simply means that the relevant package net-tools
which includes netstat
executable is not installed and, thus missing. The package net-tools
may not be installed on your system by default so you need to install it manually.
In the meantime, let’s take a look at the usage of the netstat
command on Ubuntu/Debian Linux systems:
List all Netstat Commands
To list of netstat commands, just simply use netstat -h
command for that:
netstat -h
List All Ports and Connections using nestat command:
To list all ports and connections, just simply use netstat - a
command:
netstat -a
List All TCP Ports
To list all udp ports using netstat, use netstat -at
command:
netstat -at
List All UDP Ports
To list all udp ports using netstat, use netstat -au
command:
netstat -au
List Only Listening Ports
To show only listening ports on Linux using netstat, you can use netstat -l
command:
netstat -l
List TCP Listening Ports
To list only the listening TCP ports on Linux, you can use netstat -lt
command:
netstat -lt
Netstat UDP Listening Ports linux
To list only the listening udp ports on Linux, you can use netstat -lu
command:
netstat -lu
Show Process id netstat
To show the proccess id or PID on terminal window, use netstat -tp
command:
netstat -tp
Find Listening Programs
netstat -lp
Find a Process That Is Using a Particular Port using netstat
command
To find a process running on specific port, use netstat
command:
netstat -an | grep ':[port number]'
Displays All Active tcp and udp Connections in netstat
To show all active tcp and udp connections including ports, use netstat -an
command:
netstat -an
Conclusion
That’s it; you have fixed error bash: netstat: command not found Ubuntu/Debian Linux with terminal or command line.