Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I'm trying to debug a network problem on a embedded system which has a very limited set of userspace applications. Meaning I can't use any of the following

sudo lsof -i
sudo netstat -lptu
sudo netstat -tulpn

How can i read which sockets are binded from /sys or /proc?

share|improve this question

2 Answers 2

Netstat and lsof get their information from /proc/$pid/fd/* for per-process data and from /proc/net/tcp, /proc/net/udp, /proc/net/icmp and /proc/net/raw for IPv4 socket information (and /proc/net/tcp6, /proc/net/udp6 and /proc/net/raw6 for IPv6). The equivalent of your commands is mostly to read these files in /proc/net (plus DNS lookups).

For debugging purposes, consider uploading a binary of lsof to your system, it can be a lot more convenient than rummaging in /proc.

share|improve this answer

You can get the list of binded sockets from /proc/net/tcp[6], /proc/net/udp[6] and /proc/net/raw[6].

Beware if converting the hex values in those files to "normal" IP adresses, they are in little-endian (e.g. 3900060A represents 10.6.0.57 and not 57.0.6.10 as least significant byte comes first).

share|improve this answer

Your Answer

 
discard

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.