Linux contains a lot of command line tools which make the job of a network administrator easier. One of them is netstat. Netstat is a multi-purpose network informantion tool. Using netstat, you can find which port is used by which process or user by using the following command:

# netstat -an | moreThere is a utility called fuser which also tells you which user and process owns a port. For example, if you want to find who owns port 631, you execute the following command:

$ fuser -v -n tcp 631

Note : Ports below 1024 are reserved for common services , and only root can use them. Standard port numbers can be found in /etc/services file. The rest of the over 65K ports can be used by normal users or processes.