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.ss -4tnp state established not dst 127.0.0.0/8. @ValentinBajrami btw:-lis incompatible withstate established(because it meansstate listening).ss -tlpen... most of the time. Good pointers andnot dst 127.0.0.0/8is definitely what's needed here.