Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

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

I want to know which ports are used by which processes in embedded-linux. Since it is simple embedded-linux, there are no network command lines such as netstat, lsof. (only basic command lines such as cat, cp, echo, etc exist).

A partial solution seems to be to use "cat /proc/net/tcp" and "cat /proc/net/udp" command lines. However, I am not sure the printed list from those command lines shows all ports in use, and the list does not show which process is binded to certain port.

Any comments would be appreciated.

share|improve this question

migrated from serverfault.com May 20 '14 at 10:59

This question came from our site for system and network administrators.

I think this question is better suited to Unix & Linux – Iain May 20 '14 at 7:45
up vote 9 down vote accepted

You should be able to find all open ports in /proc/net/tcp and /proc/net/udp. Each of those files have an inode column, which can be used to find the process owning that socket.

Once you have an inode number, you can run an ls command such as ls -l /proc/*/fd/* | grep socket:.$INODE to find the processes using that socket. In case a process has been set up with different file descriptors for different threads, you may need to extend the command to ls -l /proc/*/task/*/fd/* | grep socket:.$INODE in order to find them all.

share|improve this answer
find /proc -lname "socket:\[$INODE\]" 2> /dev/null – Sammitch May 21 '14 at 23:14

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.