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 ESTABLISHEDThis is much better thanlsoffor what you want. – Valentin Bajrami Dec 13 '23 at 19:34ss -4tnp state established not dst 127.0.0.0/8. @ValentinBajrami btw:-lis 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/8is definitely what's needed here. – Valentin Bajrami Dec 13 '23 at 20:06