0

I am looking for a command to see the process listening to a port, e.g. /dev/ttyS0 (with root rights on a Linux system). I can do that with

lsof /dev/ttyS0

but this is really too slow. Also, I cannot use the -p flag to make it faster.

I would like to do essentially the same using other resources of the linux system. Is that possible?

0

I've only tried it with a virtual console, but this will work (at least for some resources. I don't have a Serial port, but it worked for my tty's)

fuser -n file /dev/ttyS0

(As root, of-course)

Similarly you can look up things speaking to a socket with fuser -n tcp|udp XXXX

| improve this answer | |
  • Unfortunately, I do not have the -n option available. But I will look into fuser. – Alex Mar 21 '13 at 7:12
0

I know it is late but for future use. If lsof (with root rights) is taking too long, the reason can be that it is trying to resolve hostnames when a large number of tcp/udp ports are open. This can be avoided using -n option sudo lsof -n /dev/ttyS0 If -n option is not available then you might try -X option sudo lsof -X /dev/ttyS0

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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