Note

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.8

macOS

# Runs until stopped with Ctrl+C
ping 8.8.8.8

# Limit to 4 packets (Windows default)
ping -c 4 8.8.8.8

Trace route

Show the hop path and transit delays to a host.

Windows

tracert google.com

# Or using modern PowerShell:
Test-NetConnection google.com -TraceRoute

macOS

traceroute google.com

DNS lookup

Resolve a hostname or query DNS records.

Windows

nslookup google.com

# Or using modern PowerShell:
Resolve-DnsName google.com

macOS

nslookup google.com

# Preferred for scripts (cleaner output):
dig google.com

View IP and adapters

List current TCP/IP configuration.

Windows

ipconfig

# Or using modern PowerShell:
Get-NetIPAddress

macOS

# All adapters and details
ifconfig

# Primary Wi-Fi IPv4 only
ipconfig getifaddr en0

Active connections

List open TCP connections, listening ports, and routing tables.

Windows

netstat -an

# Or using modern PowerShell:
Get-NetTCPConnection

macOS

netstat -an

# See which process owns a port (e.g. port 80):
lsof -i :80

Routing table

Display the kernel routing table.

Windows

route print
# Or using modern PowerShell:
Get-NetRoute

macOS

netstat -nr