netstat command to find open ports
$ netstat --listen
To display open ports and established TCP connections, enter:
$ netstat -vatn
To display only open UDP ports try the following command:
$ netstat -vaun
Display PID and program names in netstat output
$ netstat -pt
Check the following link for more specific need: http://www.thegeekstuff.com/2010/03/netstat-command-examples/