Ubuntu Linux - bash: netstat: command not found - Solved

By Hardik Savani May 1, 2024 Category : Ubuntu

Hi Developer,

In this comprehensive tutorial, we will learn bash netstat command not found ubuntu. I explained simply about linux bash netstat command not found. This post will give you a simple example of ubuntu netstat command not found solution. let’s discuss about ubuntu 22.04 netstat command not found.

If you encounter the "bash: netstat: command not found" error on Ubuntu/Debian Linux and need to run the `netstat -lp` command, you can follow these step-by-step instructions:

Check If `netstat` is Installed:

First, confirm whether the `netstat` utility is installed on your system by attempting to run it:

netstat -lp

If `netstat` is not installed, you will receive the "command not found" error.

Install `net-tools` Package:

To use the `netstat` command, you can install the `net-tools` package. Open your terminal and execute these commands:

sudo apt update

sudo apt install net-tools

This updates the package list and installs the `net-tools` package, which includes the `netstat` command.

Run `netstat -lp` Again:

After installing `net-tools`, you can run the `netstat -lp` command to display listening processes along with their associated ports:

netstat -lp

This command should now work without any "command not found" error, and it will show you a list of listening processes and their ports.

Use `ss` Instead (Optional):

Alternatively, you can use the `ss` command to achieve similar results. `ss` is another network utility that provides socket statistics and can replace `netstat`:

ss -tuln

This `ss` command lists the listening TCP and UDP ports, similar to `netstat -lp`.

By following these steps, you should be able to resolve the "bash: netstat: command not found" error and successfully execute the `netstat -lp` or `ss -tuln` command on your Ubuntu/Debian Linux system.

I hope it can help you...

Tags :
Shares