ss - linux socket statistics utility output format
32
votes
3
answers
13955
views
When using
ss
with -p
option, user/pid/fd
column jumps underneath the particular line. For instance this is it what I'm actually seeing:
# ss -nulp4
State Recv-Q Send-Q Local Address:Port Peer Address:Port
UNCONN 0 0 *:20000 *:*
users:(("perl",pid=9316,fd=6))
UNCONN 0 0 *:10000 *:*
users:(("perl",pid=9277,fd=6))
UNCONN 0 0 192.168.100.10:53 *:*
users:(("named",pid=95,fd=517),("named",pid=95,fd=516))
UNCONN 0 0 127.0.0.1:53 *:*
users:(("named",pid=95,fd=515),("named",pid=95,fd=514))
**Preferred output formatting**:
# ss -nulp4
State Recv-Q Send-Q Local Address:Port Peer Address:Port
UNCONN 0 0 *:20000 *:* users:(("perl",pid=9316,fd=6))
UNCONN 0 0 *:10000 *:* users:(("perl",pid=9277,fd=6))
UNCONN 0 0 192.168.100.10:53 *:* users:(("named",pid=95,fd=517),("named",pid=95,fd=516))
UNCONN 0 0 127.0.0.1:53 *:* users:(("named",pid=95,fd=515),("named",pid=95,fd=514))
To confirm that there are no line breaks I've tried this:
# ss -nulp4 | cat -A
State Recv-Q Send-Q Local Address:Port Peer Address:Port $
UNCONN 0 0 *:20000 *:* users:(("perl",pid=9316,fd=6))$
UNCONN 0 0 *:10000 *:* users:(("perl",pid=9277,fd=6))$
UNCONN 0 0 192.168.100.10:53 *:* users:(("named",pid=95,fd=517),("named",pid=95,fd=516))$
UNCONN 0 0 127.0.0.1:53 *:* users:(("named",pid=95,fd=515),("named",pid=95,fd=514))$
And indeed you can see that there were none, but now, strangely enough, output format is the way I've wanted it to be. Could someone explain what's going on here? How can I achieve my preferred formatting?
This is the only thing stopping me from migrating from netstat
to ss
.
Asked by NarūnasK
(2525 rep)
Jan 1, 2016, 08:26 PM
Last activity: Nov 24, 2021, 05:54 AM
Last activity: Nov 24, 2021, 05:54 AM