LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Opened sockets. Bash (https://www.linuxquestions.org/questions/linux-newbie-8/opened-sockets-bash-4175431665/)

julirio 10-11-2012 08:11 AM

Opened sockets. Bash
 
Hi! I need to know how can I get the amount of open sockets per active processes iniciated in the current session.
However in order to get the number I can not use any command as netstat, I must find out the number by accessing to the /proc directory
per session refers to the relationship established between the user and the operating system after logging. (One terminal)

kooru 10-13-2012 04:13 AM

Hi,

i don't know if i understand what you want, but have you tried lsof?

Ygrex 10-13-2012 04:44 AM

all file descriptors can be found under /proc/<PID>/fd ; each open socket has an associated descriptor and the entry looks somehow like this:
Code:

$ sudo readlink /proc/6196/fd/3
socket:[43113]


julirio 10-13-2012 04:48 AM

I´ve tried that. But i must do it using a non-root user. So i can not use "sudo"


All times are GMT -5. The time now is 12:37 PM.