Skip to content
Linux

Networking

Inspect interfaces, ports, connections, and DNS.

By EZ4Code Team
networkipports

Code

# Interfaces and addresses
ip addr show
ip -br link
ip route
ip -s link

# Port and connection inspection
ss -tlnp                       # TCP listening ports + process
ss -tnp state established
netstat -tulpn                 # legacy alternative

# Connectivity
ping -c 4 example.com
traceroute example.com
mtr -c 10 example.com

# DNS
dig +short example.com
nslookup example.com 8.8.8.8
getent hosts example.com

# Curl and HTTP debugging
curl -sI https://example.com
curl -w "@curl-format.txt" -o /dev/null -s https://example.com

Explanation

ip (from iproute2) is the modern replacement for ifconfig and route. ss is faster and more informative than netstat for showing sockets and the processes behind them. dig queries DNS records, and curl with -I fetches only headers for quick HTTP debugging. mtr combines ping and traceroute into a live view.

More Linux Snippets