Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Using lsof, I can find all of the processes with a TCP socket listening for connections:

lsof -Pni -sTCP:LISTEN


cupsd     662   root  7u  IPv6   11108      0t0  TCP [::1]:631 (LISTEN)
cupsd     662   root  8u  IPv4   11109      0t0  TCP (LISTEN)
rsyncd    905   root  4u  IPv4   13379      0t0  TCP *:873 (LISTEN)

Is there any way (without piping the output to another program, like grep, awk, or sed) to limit this to TCP sockets listening on the wildcard address? Tried:

$ lsof -Pni @ -sTCP:LISTEN
lsof: incomplete Internet address specification: -i @


$ lsof -Pni @\* -sTCP:LISTEN
lsof: unknown host name (*) in: -i @*

Alternatively, is there any way to generically negate the conditions passed to lsof?

share|improve this question
Looks like a bug in lsof to me! – Celada Feb 3 '13 at 22:01

Do you have to use lsof?

netstat -tulpn will show the processes that are listening on any given port. Processes listening on all IPs will show as

share|improve this answer
But this command shows also processes which listen on a specific IP, like lsof -Pni -sTCP:LISTEN?! – mpy Jun 29 '13 at 14:16

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.