Using lsof
command I would like to print out TCP
connections with ESTABLISHED
state but ignoring the ones with localhost.
I tried:
lsof -itcp@^127.0.0.1 -stcp:established
lsof -itcp@(^127.0.0.1) -stcp:established
lsof -itcp -i ^@127.0.0.1 -stcp:established
and others similar, but always getting sintax error response.
What is correct sintax?
ss -tlpn -o state ESTABLISHED
This is much better thanlsof
for what you want. – Valentin Bajrami Dec 13 '23 at 19:34ss -4tnp state established not dst 127.0.0.0/8
. @ValentinBajrami btw:-l
is incompatible withstate established
(because it meansstate listening
). – A.B Dec 13 '23 at 19:43ss -tlpen
... most of the time. Good pointers andnot dst 127.0.0.0/8
is definitely what's needed here. – Valentin Bajrami Dec 13 '23 at 20:06