Sobes.tech
Junior

On which ports can you see current connections in the LISTENING state?

sobes.tech AI

Answer from AI

# View all LISTENING ports with process information
sudo netstat -tulnp | grep LISTEN
# View all LISTENING ports with process information (alternative with ss)
sudo ss -tulnp | grep LISTEN

Main ports and protocols where LISTENING connections are commonly found:

Protocol Port Description
TCP 22 SSH (Secure Shell)
TCP 80 HTTP (Hypertext Transfer Protocol)
TCP 443 HTTPS (HTTP Secure)
TCP 25 SMTP (Simple Mail Transfer Protocol)
TCP 5432 PostgreSQL Database Server
TCP 3306 MySQL Database Server
TCP 6379 Redis
TCP 27017 MongoDB

The netstat and ss commands display information about current network connections and listening ports. Flags -t (TCP), -u (UDP), -l (LISTENING), -n (numeric addresses), -p (process) are used for filtering and displaying the needed information. grep LISTEN filters lines containing the word "LISTEN", indicating ports in the listening state for incoming connections.