Popular port numbers in Linux

HTTP – TCP 80

HTTPS – TCP 443

POP3 – TCP 110

SMTP – TCP 25

SSH – TCP 22

DNS/DOMAIN – TCP/UDP 53

 

Use the cat command or grep command/egrep command to query port numbers as follows:

cat /etc/services
grep -w 80 /etc/services
egrep -w '53/(tcp|udp)' /etc/services

 

How to check if a port is in use on Linux

 

1. Open the terminal application

2. Type any one of the followin command to check if a port is in use on Linux

sudo lsof -i -P -n | grep LISTEN 
sudo netstat -tulpn | grep LISTEN
sudo netstat -tulpn | grep :443
sudo ss -tulpn | grep LISTEN
sudo ss -tulpn | grep ':22'

 

Getting a list of all open port in production

Simply run:

sudo lsof -i -P -n | grep LISTEN
sudo ss -tulpn
sudo netstat -tulpn

 

Was this answer helpful? 0 Users Found This Useful (0 Votes)