kernel Asked: 2011-06-20 04:43:45 +0800 CST2011-06-20 04:43:45 +0800 CST 2011-06-20 04:43:45 +0800 CST How to get sockets which are listening on a specific port in linux? 772 An application may be binding multiple sockets to a specific port,how can I get those sockets command line? linux socket 3 Answers Voted Best Answer scetoaux 2011-06-20T05:21:42+08:002011-06-20T05:21:42+08:00 lsof will also provide you with information about open sockets: $ lsof -i TCP:17500 COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME Dropbox 244 username 19u IPv4 0x05584748 0t0 TCP *:17500 (LISTEN) petrus 2011-06-20T04:59:50+08:002011-06-20T04:59:50+08:00 Netstat can provide you this information : petrus@srv:~$ sudo netstat -taunp Connexions Internet actives (serveurs et établies) Proto Recv-Q Send-Q Adresse locale Adresse distante Etat PID/Program name tcp 0 0 127.0.0.1:4949 0.0.0.0:* LISTEN 7837/munin-node tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 6399/sshd udp 0 0 0.0.0.0:56317 0.0.0.0:* 9639/rpc.statd udp 0 0 0.0.0.0:911 0.0.0.0:* 9639/rpc.statd Output shortened for clarity. bagavadhar 2011-06-20T22:40:09+08:002011-06-20T22:40:09+08:00 If you are using *bsd system (I don't know if it exist for linux and other *nix), there is this socksat command, which does what you are looking for.
lsof will also provide you with information about open sockets:
Netstat can provide you this information :
Output shortened for clarity.
If you are using *bsd system (I don't know if it exist for linux and other *nix), there is this socksat command, which does what you are looking for.