netstat command on WSL doesn't give any messages
$ netstat -nap
(No info could be read for "-p": geteuid()=1000 but you should be root.)
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
Active UNIX domain sockets (servers and established)
Proto RefCnt Flags Type State I-Node PID/Program name Path
nestat
command gives no information about ports are using. For example, I'm running redis-server on this PC but it is not displayed here.
How to I fix this? Linux distro is Microsoft WSL Ubuntu 18.04.
/proc/net/tcp
is not implemented for WSL, hence accessing these networking proc
interfaces does not work. The netstat
or ss
commands access these and, since they are not implemented, they do not work in WSL on Ubuntu.
From Windows PowerShell, running the command Get-NetTCPConnection
gives the equivalent netstat output