Hacker News new | ask | show | jobs
by hobr 3568 days ago
What do you recommend as a replacement? I'd love to get something that wasn't quite so opaque.
2 comments

Ss has replaced netstat. (By the way each time you're typing netstat you're suppposed to get a message telling it's obsolete). ss is an improvment on performance and features, but unfortunately the ui isn't much improved compared to netstat ...
Nifty, `ss -i` seems useful. I think most of the rest of the info you can get with netstat, though (and there doesn't seem to be a way to resolve usernames, as `netstat -e` does).

Is there a way to make the output not justified to the width of my terminal? The extra whitespace makes it hard to see which rows match up, and also makes it annoying to paste into IM or email.

> (and there doesn't seem to be a way to resolve usernames, as `netstat -e` does)

Challenge accepted:

  ss -e | grep uid | gawk 'match($0,/uid:([0-9]+)/,u) {printf "%s user:",$0;system("getent passwd "u[1]" | cut -d: -f1");}'
Not your point, I know, but it was fun.
You lose three points for using grep and gawk in the same pipeline. :P
Oops, the grep was just to filter the lines that actually have a uid while I worked on it, it's not needed or desired if you were to actually use this. You can remove that part. :P
I wish utilities would use more characters, Because it makes searching so much easier. You can always alias it to something else, but for example, it is way easier to search for ifconfig than it is to search for ip (for iproute)
AFAIK ss was not meant to be a complete replacement of netstat. The ss utility (part of iproute2) uses netlink to monitor sockets only. The netstat utility (part of net-tools) uses old school ioctls to do things like manage routing tables, multicast membership, interface stats...long story short, iproute2 replaces net-tools.
> By the way each time you're typing netstat you're suppposed to get a message telling it's obsolete

Starting about when? Most of the distros I use are a couple years old, and I don't see "ss" under the package managers.

It's from iproute2 - sockstat "ss" Circa ~ 2001, although it's been through a few maintainers since.

https://github.com/shemminger/iproute2/commits/master/misc/s...

It's installed by default at my Debian stable computer. Yet, there is not package for it, must be at the basic tools.
I like ss, except I can never seem to remember the name. The two letters don't seem to have any relation to the functionality.

The man page refers to it as "ss - another utility to investigate sockets". That doesn't seem to help.

For different (historical ww2 reasons) I don't like the name and I wish ss had a more meaningful name ...
ss - Sockets Stat (?)
In Europe ( at least in France ) ss means Nazis' Waffen SS. Something like sostat would have been a better choice imho.
Sorry, I'm from Europe too, and I did feel in my skin, the Nazi ideology that remains, when working in Holland/The Netherlands for 2 years. If I read "ss" in a computer/programing context, I don't think about Nazis. The same that I love rainbows, and I'm not gay.

People takes symbols as a totalitarian thing. We are free to skip their imposition and use things as we like. We are still free to do it. Really. We can appreciate the beauty of a rainbow after a rain/sun combination, and not impose our sexual unsolicited demonstrations to anyone because of it. It's just a nature thingy.

We can say "ss" for a program that print sockets stats, and skip remembering Nazis. It's opensource, any skin tone can use, modify and redistribute, ss. We can do it, or, we can stick to bad memories, and name things just and only, as Israeli stuff.

I didn't think about it, and probably the person that did name the program, neither. Anyway, I see your point, the name can bring negative sentiments to some persons which see the daemon in a piece of source code or in an acronym in unrelated context.

> Ss has replaced netstat.

what about non-tcp/non-udp sockets e.g. sctp ? ss doesn't seem to support that (but i might be mistaken)

You're right but as I'm not using it I don't know what's the situation about that.
How do you get `netstat -s` information out of ss?
ss -anp | grep LISTEN
You don't need grep for that, ss can already filter by state on its own. Use: "ss -o state LISTENING"
Sometimes I find typing grep/cut/awk/etc to be easier to remember than custom flags and thus faster to type. Often times my time spent looking through the man page is better spent just writing a more verbose command line.
+1. You can see the same effect in natural language as modern English has fewer tenses and declensions and makes heavier use of helper words, as contrasted with olde English. Same with Latin vs modern romance.