4 ms·
> (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) {p
by mVChr 10y ago
> (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.
- deleted 10y ago[deleted]
- wang_li 10y agoYou lose three points for using grep and gawk in the same pipeline. :P
- mVChr 10y agoOops, 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