ss is replacing netstat, how can I get it to list ports similarly to what I am used to?

26,328

A recent version of ss should also display UDP listeners in that way. You can limit to UDP with ss -unlp.

I have tried a recent Debian version where ss --version reports ss utility, iproute2-ss140804 and that does work.

On A Red Hat 5 system with ss utility, iproute2-ss061002 it doesn't. You do get more info there using ss -aunp although that also shows connected ports.

You can also try:

ss -apu state unconnected 'sport = :1812'
Share:
26,328

Related videos on Youtube

azzid
Author by

azzid

Updated on September 18, 2022

Comments

  • azzid
    azzid over 1 year

    I've been trying to modernise my way with Linux by, for one thing, ditching netstat for ss. I looked up my favourite command line flag for netstat in the ss man pages, and was very glad to find that netstat -lnp is more or less the same command as ss -lnp. Or so I thought...

    # ss -lnp | grep 1812
    

    Turns up nothing, but

    # netstat -lnp | grep 1812
    udp        0      0 0.0.0.0:1812            0.0.0.0:*                           11103/radiusd
    

    does. A fact that made that particular troubleshooting unnecessarily harder.

    Now I'm trying to understand how I should have used ss to verify that the daemon was listening.

    Can someone please explain?

    EDIT:

    # ss --version
    ss utility, iproute2-ss090324
    # ss -aunp | grep radi
    UNCONN     0      0                         *:50482                    *:*      users:(("radiusd",11103,11))
    UNCONN     0      0                 127.0.0.1:18120                    *:*      users:(("radiusd",11103,9))
    UNCONN     0      0                         *:1812                     *:*      users:(("radiusd",11103,6))
    UNCONN     0      0                         *:1813                     *:*      users:(("radiusd",11103,7))
    UNCONN     0      0                         *:1814                     *:*      users:(("radiusd",11103,10))
    # ss -lnp | grep radi
    #
    
    • Admin
      Admin over 9 years
      Does radiusd show at all in ss?
  • Navin
    Navin over 6 years
    Odd, none of these commands work on a Raspberry Pi with ss version ss140804. However, they work perfectly on Fedora with ss version ss170501. I guess that's what happens when I use three year old software :(
  • wurtel
    wurtel over 6 years
    That's why I wrote "A recent version ..." :-)