I'm far used to the output of netstat -taulpen
, and although I don't know what all the flags do specifically, it gives a nice readable table of networking programs, and when run as sudo can show all process names inline with the address and socket they listen on etc.
With ss
I get close with:
$ ss -tlnp
-n, --numeric don't resolve service names
-l, --listening display listening sockets
-p, --processes show process using socket
-t, --tcp display only TCP sockets
As you can imagine this gives output like this: I've manually wrapped the lines as they appear in the terminal output:
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0 50 *:139 *:*
users:(("smbd",874,33))
LISTEN 0 5 127.0.1.1:53 *:*
users:(("dnsmasq",1528,5))
LISTEN 0 128 127.0.0.1:631 *:*
users:(("cupsd",782,11))
So my problem is I have a lot of space in my terminal emulator, but ss is very firm on wrapping the first few columns to 100% width, and the remaining columns fall off and wrap, even though there is no literal newline shown in xxd.
ss -tlnp | column -t
. If it bothers you that the header line is not correctly aligned (because the headers contain spaces), you can suppress it with the-H
option or withsed
. Soss -H -tlnp | column -t
orss -tlnp | sed 1d | column -t