110

Was netstat removed in 16.04? Is there an alternative to netstat available in 16.04? Or how do I install netstat in 16.04?

I am running an ubuntu:16.04 container in docker for Windows, it seems that netstat is no longer available... It is available in an ubuntu:14.04 container.

I have tried installing netstat with apt-get but with no luck...

apt-get update

...

apt-get install netstat
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package netstat

It might be that the solution to this is very obvious to most devs, however Linux is very new to me... enjoying it a lot!

3 Answers3

185

As you can see from https://packages.ubuntu.com/xenial/amd64/net-tools/filelist, netstat is provided by the net-tools package. Therefore, you can get netstat by running:

sudo apt update
sudo apt install net-tools

net-tools is probably not installed by default in the Docker image for Ubuntu 16.04 to keep the image size as small as possible.

edwinksl
  • 24,109
41

In my opinion is better to begin adapting yourself to new tools.

ss is auto-defined as "another utility to investigate sockets"

ss -ltu

Will show listening sockets for tcp and udp.

For more information you can use ss --help or man ss. The program ss can be found in the iproute2 package.

JamesThomasMoon
  • 303
  • 2
  • 14
2

The version of ubuntu that's provided for use in containers has much less installed in it than a typical desktop installation.

Netstat is still available in Ubuntu 16.04 (via the net-tools package). It's just that that package isn't installed inside docker containers by default.

mc0e
  • 368