Linux, Windows, Virtualization, OpenSource & Blogging

netstat Command not found on Debian / Ubuntu / Linux Mint – Quick Fix

0

netstat is a command line tool to view the network connection statistics to/from the machine. With netstat, you can see network connections, routing tables, interface statistics, masquerade connections, and multicast memberships.

Are you facing netstat command not found issue after the installation Debian / Ubuntu / Linux Mint.

-bash: netstat: command not found

Here is the small guide to install the necessary package for getting netstat command. Let us see which package provides us netstat command.

apt-file search --regexp '/netstat$'

Output:

net-tools: /bin/netstat

From the above command, you can see that net-tools package provides you netstat command. So, install the net-tools package using the apt-get command.

apt-get install -y net-tools

Output:

Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
 net-tools
0 upgraded, 1 newly installed, 0 to remove and 98 not upgraded.
Need to get 248 kB of archives.
After this operation, 963 kB of additional disk space will be used.
Get:1 http://deb.debian.org/debian stretch/main amd64 net-tools amd64 1.60+git20161116.90da8a0-1 [248 kB]
Fetched 248 kB in 0s (422 kB/s)
Selecting previously unselected package net-tools.
(Reading database ... 131147 files and directories currently installed.)
Preparing to unpack .../net-tools_1.60+git20161116.90da8a0-1_amd64.deb ...
Unpacking net-tools (1.60+git20161116.90da8a0-1) ...
Processing triggers for man-db (2.7.6.1-2) ...
Setting up net-tools (1.60+git20161116.90da8a0-1) ...

Once the installation is complete. Run netstat to see whether it is available or not.

netstat

Output:

Active Internet connections (w/o servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State
tcp        0      0 mydebian:ssh            192.168.1.5:55051       ESTABLISHED
tcp        0      0 mydebian:ssh            192.168.1.6:55368       ESTABLISHED
tcp        0     64 mydebian:ssh            192.168.1.6:55660       ESTABLISHED
Active UNIX domain sockets (w/o servers)
Proto RefCnt Flags       Type       State         I-Node   Path
unix  2      [ ]         DGRAM                    16007    /run/user/119/systemd/notify
unix  2      [ ]         DGRAM                    9360     /run/systemd/journal/syslog
unix  2      [ ]         DGRAM                    17319    /run/user/1000/systemd/notify
unix  3      [ ]         DGRAM                    9176     /run/systemd/notify
unix  2      [ ]         DGRAM                    9178     /run/systemd/cgroups-agent
unix  28     [ ]         DGRAM                    9190     /run/systemd/journal/dev-log
unix  8      [ ]         DGRAM                    9208     /run/systemd/journal/socket
unix  3      [ ]         STREAM     CONNECTED     23927    /run/user/1000/bus
unix  3      [ ]         STREAM     CONNECTED     22423    /run/systemd/journal/stdout
unix  3      [ ]         STREAM     CONNECTED     26620    /run/user/1000/bus
unix  3      [ ]         STREAM     CONNECTED     25601
unix  3      [ ]         STREAM     CONNECTED     23390    /run/systemd/journal/stdout
unix  3      [ ]         STREAM     CONNECTED     23284    /run/user/1000/bus
unix  3      [ ]         STREAM     CONNECTED     23270
unix  3      [ ]         STREAM     CONNECTED     23043
unix  3      [ ]         STREAM     CONNECTED     24356    /var/run/dbus/system_bus_socket
unix  3      [ ]         STREAM     CONNECTED     131096   /var/run/dbus/system_bus_socket
unix  3      [ ]         STREAM     CONNECTED     23046    /run/user/1000/bus
netstat Command not found on Debian - netstat command output
netstat Command not found on Debian – netstat command output

That’s All. You now have netstat command on your machine.

You might also like
Shares