Linux commands to find the port number i.e. open port

How do I find out open port number on CentOS Linux? I try netstat but it says command not found. How can I know what service is running on a particular port in linux say port number 443? Is it Apache or Nginx server? How do I find out list of all open ports in Linux terminal?

Use lsof command:

sudo lsof -i :443 -S
sudo lsof -i :443 -S -n
sudo lsof -i -P -n | grep LISTEN 
sudo netstat -tulpn | grep LISTEN
sudo nmap -sTU -O IP-address-Here

See my tutorial page for more info:

Correction: Ignore my answer below, I did not see that you want terminal only.
In that case just nmap will work.

Nixcraft’s answer is the intelligent (and right ) way to do it. But if you just want to see all open ports, use zenmap

Linux sysadmin blog - Linux/Unix Howtos and Tutorials - Linux bash shell scripting wiki