In a terminal window, type /bin/netstat -an | grep portnumber where portnumber is the port number that you want to query. For example:
# /bin/netstat -an | grep 8443 # |
If the port is not in use, only the command-line prompt is returned as shown above.
If the port is in reserved or in use, the status of the port is returned. For example:
# /bin/netstat -an | grep 1161 # *.1161 Idle # /bin/netstat -an | grep 8080 # 172.16.0.0.8080 *.* 0 0 24576 0 LISTEN |
where 172.16.0.0 is the IP address of the machine on which you entered the netstat command.