Getting the "bash: netstat: command not found" error in Ubuntu Linux? Don't worry! This easy-to-follow guide with images will show you how to fix it in minutes.
If you are trying to run the netstat
command on Ubuntu Linux and you are getting the error message bash: netstat: command not found
, it means that the netstat
command is not installed on your system.
To install the netstat
command, you can use the following command:
sudo apt install net-tools
This will install the net-tools
package, which includes the netstat
command.
Once the net-tools
package is installed, you can verify that the netstat
command is installed by running the following command:
netstat --version
You should see output similar to the following:
netstat (net-tools 3.15)
If you are still getting the error message bash: netstat: command not found
after installing the net-tools
package, it is possible that the netstat
command is not in your PATH
environment variable.
To add the netstat
command to your PATH
environment variable, you can open your .bashrc
file and add the following line to the end of the file:
export PATH=$PATH:/usr/sbin
This will add the /usr/sbin
directory to your PATH
environment variable, which is where the netstat
command is located.
Once you have added the netstat
command to your PATH
environment variable, you need to reload your .bashrc
file by running the following command:
source ~/.bashrc
Now, you should be able to run the netstat
command without any errors.
Additional Notes
netstat
command using a Snap package. To do this, open a terminal window and type the following command:sudo snap install netstat
netstat
command, type the following command in a terminal window:sudo apt remove net-tools
Conclusion
If you are getting the error message bash: netstat: command not found
on Ubuntu Linux, it means that the netstat
command is not installed on your system. To install the netstat
command, you can use the sudo apt install net-tools
command.