How to find out unused port on Linux server We are trying to use port 5444 for our new PostgreSQL instance and we are not sure whether 5444 is used or unused.

Could you please help us to find the answers to the below questions.


We want to find out all the used and unused ports report on PROD Linux servers (RHEL 7.2). 
Also find out the application port even the application was shutdown.


Is there any file on Linux servers which holds all the ports (or sockets) info for helping with the above query?
netstat -an | grep LISTEN | grep 5444 will show if there's a process listening on that port. 

netstat -an | grep LISTEN will show you all ports with a process listening on them. You can then use lsof to see which processes are actually using a given port. 

There's no such concept of "find out the application port even the application was shutdown", as anything can listen on any port (with certain restrictions if not running as root). The closest thing to this is the /etc/services file, which documents ports that are "well known"/assigned by IANA. Also see http://www.iana.org/assignments/port-numbers. But, as I said, there's nothing to stop anything from running on one of these ports. 

To be honest, you should know what's running on a production box that you have root access to?