Network utilities: Windows and macOS
Same diagnostic task, different command depending on the OS. Match Windows (PowerShell/CMD) to macOS (Terminal) below.
Test a TCP port
Check whether a host accepts TCP connections on a given port.
Windows
Test-NetConnection <address> -Port <port>macOS
nc -vz <address> <port>Ping (ICMP)
Verify that a host responds on the network.
Windows
# Stops automatically after 4 packets
ping 8.8.8.8macOS
# Runs until stopped with Ctrl+C
ping 8.8.8.8
# Limit to 4 packets (Windows default)
ping -c 4 8.8.8.8Trace route
Show the hop path and transit delays to a host.
Windows
tracert google.com
# Or using modern PowerShell:
Test-NetConnection google.com -TraceRoutemacOS
traceroute google.comDNS lookup
Resolve a hostname or query DNS records.
Windows
nslookup google.com
# Or using modern PowerShell:
Resolve-DnsName google.commacOS
nslookup google.com
# Preferred for scripts (cleaner output):
dig google.comView IP and adapters
List current TCP/IP configuration.
Windows
ipconfig
# Or using modern PowerShell:
Get-NetIPAddressmacOS
# All adapters and details
ifconfig
# Primary Wi-Fi IPv4 only
ipconfig getifaddr en0Active connections
List open TCP connections, listening ports, and routing tables.
Windows
netstat -an
# Or using modern PowerShell:
Get-NetTCPConnectionmacOS
netstat -an
# See which process owns a port (e.g. port 80):
lsof -i :80Routing table
Display the kernel routing table.
Windows
route print
# Or using modern PowerShell:
Get-NetRoutemacOS
netstat -nr