1. You can check out the open files of a process:
[wh5a@pri-036 wh5a]$ ps -p 10189
PID TTY TIME CMD
10189 pts/0 00:00:00 a.out
[wh5a@pri-036 wh5a]$ ls -l /proc/10189/fd
total 0
lrwx------ 1 wh5a wh5a 64 Nov 10 00:32 0 -> /dev/pts/0
lrwx------ 1 wh5a wh5a 64 Nov 10 00:32 1 -> /dev/pts/0
lrwx------ 1 wh5a wh5a 64 Nov 10 00:32 2 -> /dev/pts/0
lrwx------ 1 wh5a wh5a 64 Nov 10 00:32 3 -> socket:[8081190]
2. Now you may wonder what the number 8081190 means. It is the inode assigned by the OS for it:
# output all tcp conns with extended info
[wh5a@pri-036 wh5a]$ netstat -tae
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State User Inode
tcp 0 0 *:36864 *:* LISTEN wh5a 8081190
tcp 0 0 *:32768 *:* LISTEN rpcuser 2118
..........
3. Say you want to know which process opened port 36864 (inode # also shown):
# the manpage of lsof has more info
[wh5a@pri-036 wh5a]$ sudo lsof -i tcp:36864
COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME
a.out 10189 wh5a 3u IPv4 8081190 TCP *:36864 (LISTEN)