How can you enable HTTP 2?
This article is about HTT2 and how you can enable HTT2 in WHM What is…
Open ports show which services are accepting connections on your Linux host. Checking them helps validate firewall rules, troubleshoot connectivity, and harden exposed services. Below are three reliable ways to inspect ports using netstat, nmap, and lsof.
Note: On newer distributions, netstat is provided by net-tools. If unavailable, consider ss as a modern alternative.
Before checking open ports, it helps to know how Linux organizes port numbers. Ports are divided into three basic ranges.
System ports range from 0 to 1023. These are reserved for well‑known services like SSH (22), HTTP (80), and HTTPS (443). Only privileged users or system-level processes can use these ports.
User ports range from 1024 to 49151. Regular applications and services commonly use these ports. Web servers, databases, and custom scripts often operate here.
Private ports range from 49152 to 65535. These are mostly used for temporary connections, random port assignments, and local client communication.
Below are three reliable approaches: netstat for quick, local inspection; nmap for scanning like an external client; lsof for mapping ports to processes.
Retrieving a list of all TCP and UDP ports that are currently listening
netstat -tuln
Lists listening TCP and UDP sockets with numeric addresses and ports, providing a quick overview of active services.
netstat -l
Shows only sockets in listening state, useful for confirming which services are awaiting inbound connections.
netstat -tn
Displays TCP sockets and established connections with numeric output, helping verify ongoing client traffic and port usage.
netstat -un
Shows active UDP sockets in numeric form, helpful for troubleshooting stateless services and lightweight protocols.
Tip: Add -p (e.g., netstat -tulnp) to display associated process IDs
and program names where permitted.
Nmap helps you scan a system like an external client, revealing open ports, active services, and potential security exposures.
nmap example.com
Performs a basic scan against a host, identifying open ports and responsive services from an external perspective.
nmap -sT localhost
Runs a TCP connect scan, enumerating ports accepting connections to validate which services are reachable locally.
nmap -sU localhost
Probes UDP listeners, which can respond unpredictably; helpful for discovering DNS, DHCP, and other UDP services.
nmap -p 443 example.com
Targets a single port to confirm openness and service availability, ideal for focused troubleshooting of one endpoint.
nmap -sT -sU -p- localhost
Sweeps all TCP and UDP ports, providing comprehensive visibility into every listening service on the scanned host.
Note: UDP scans can be slow; consider narrowing targets or increasing
timing cautiously to manage duration.
Lsof shows which running processes are using specific ports, helping you trace network activity and quickly diagnose service conflicts.
lsof -i
Shows processes with open network files, revealing listening ports and active connections from a process‑centric viewpoint.
lsof -i :8080
Identifies which program owns a given port, enabling quick resolution of conflicts and unexpected bindings.
lsof -iTCP -iUDP
Combines TCP and UDP views to present all active sockets, simplifying audits across both protocol families.
Pro tip: Add -P -n to lsof to skip service and DNS lookups for
faster, numeric output.
Regularly checking open ports helps you validate service exposure, spot misconfigurations, and tighten security. Use netstat for quick snapshots, nmap for external scanning, and lsof to map ports to processes. Together, these tools provide a complete picture of your system’s network surface fast, accurate, and script‑friendly.
Discover How To Find Open Ports On Netstat and monitor active ports to improve Linux server security.
Explore more hosting insights, tips and industry updates.
This article is about HTT2 and how you can enable HTT2 in WHM What is…
If there is only one dedicated web server that responds to HTTP request on the…
This guide will help you understand how to configure password strength for users in WHM.…