How to Check Open Ports on Windows, Mac, and Linux: Complete Guide

Checking Open Ports on Windows

To check open ports on Windows 10 or 11, launch Command Prompt as administrator and execute netstat -ano. This lists all TCP and UDP connections with process IDs. Filter results using netstat -ano | findstr :80 to identify listeners on specific ports like HTTP. Cross-reference PIDs in Task Manager under the Details tab for associated applications. For PowerShell users, run Get-NetTCPConnection | Where-Object {$_.State -eq “Listen”} to retrieve detailed output including local addresses and owning processes. Enhance visibility with Get-Process -Id (Get-NetTCPConnection -LocalPort 443).OwningProcess for quick identification.

Resource Monitor offers a graphical alternative. Search for resmon in the Start menu, navigate to the Network tab, and expand Listening Ports to view real-time data. This method suits users preferring visuals over command lines. Third-party tools like TCPView from Microsoft Sysinternals provide sortable tables with refresh options, though built-in utilities suffice for most audits.

Checking Open Ports on Mac

On macOS, open Terminal and use lsof -i -P | grep LISTEN to display all listening ports with process names. Add sudo for comprehensive results across system processes. The command sudo lsof -n -i :22 reveals SSH activity specifically. Netstat serves as backup via netstat -an | grep LISTEN, showing address families and states without process details.

Activity Monitor provides GUI access. Select the Network tab after launching the app from Applications/Utilities, then review open connections. For advanced scanning, install Homebrew and nmap, then execute nmap -sT localhost to probe TCP ports from 1 to 1024. Combine outputs with firewall status checks using sudo pfctl -s all to ensure macOS security layers align with exposed services.

Checking Open Ports on Linux

Linux distributions support ss -tuln for socket statistics, listing TCP and UDP listeners with numeric ports in concise format. ss -tuln | grep :80 isolates web server activity. Netstat remains available on many systems through net-tools package installation, using netstat -tuln for similar data including state columns.

Nmap delivers deeper insights after sudo apt install nmap on Debian-based systems. Run nmap -sS -O 127.0.0.1 for SYN scan results highlighting open ports and OS detection. Lsof -i -P | grep LISTEN works identically to macOS for process mapping. Firewall verification via sudo ufw status or sudo iptables -L prevents overlooked blocks. Regular audits with these commands maintain network hygiene across distributions like Ubuntu, Fedora, and Arch.

Leave a Reply

Your email address will not be published. Required fields are marked *