bash: netstat: command not found – Ubuntu/Debian

bash: netstat: command not found – Ubuntu/Debian; Through this tutorial, we will see how to resolve bash: netstat: command not found – Ubuntu/Debian error.

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 or in Debian. Execute the following command to install netstat tool on Ubuntu 22.04 LTS.

sudo apt update
sudo apt install net-tools

This simply means that the relevant package net-tools which includes netstat executable is not installed, thus missing. The package net-tools may not be installed on your system by default so you need to install it manually.

Meanwhile, let’s have a look into the usage of netstat command.

List All netstat Commands

netstat -h

List All Ports and Connections using nestat command:

Run the following netstat command to list all ports and connections.

netstat -a

List All TCP Ports

netstat -at

List All UDP Ports

netstat -au

List Only Listening Ports

netstat -l

List TCP Listening Ports

netstat -lt

List UDP Listening Ports

netstat -lu

Display PID

netstat -tp

Find Listening Programs

netstat -lp

Find a Process That Is Using a Particular Port using netstat command

netstat -an | grep ':[port number]'

Recommended Linux Ubuntu Tutorials


My name is Devendra Dode. I am a full-stack developer, entrepreneur, and owner of I like writing tutorials and tips that can help other developers. I share tutorials of PHP, Python, Javascript, JQuery, Laravel, Livewire, Codeigniter, Node JS, Express JS, Vue JS, Angular JS, React Js, MySQL, MongoDB, REST APIs, Windows, Xampp, Linux, Ubuntu, Amazon AWS, Composer, SEO, WordPress, SSL and Bootstrap from a starting stage. As well as demo example.

Leave a Reply

Your email address will not be published. Required fields are marked *