Essential Linux Networking Commands Cheat Sheet
Linux
Essential Linux Networking Commands
Core Live Network Monitors
Network Statistics: See all open ports and the exact processes using them.
ss -tulnpView raw packet streams across all active interfaces.
tcpdump -i anyView fundamental packet drop, bytes sent/received, and error statistics for your cards.
ip -s linkStandalone Monitoring Utilities
Focuses on individual IP-to-IP connection analysis. Ideal for spotting remote server hogs.
iftopMaps active network traffic directly to local Process IDs (PIDs). Ideal for catching rogue scripts or background apps.
nethogsProvides total interface speed curves using clean terminal ASCII graphs. Ideal for monitoring real-time speed testing.
nloadPerforms persistent, background data accumulation. Ideal for tracking daily/monthly data caps against ISP allocations.
vnstatDelivers a lightning-fast snapshot of active ports and sockets to check listening server configurations.
ssInterface Configuration & IP Addresses
Show all network interfaces, status, and assigned IP addresses
ip addr showShow information for a specific interface (e.g., eth0)
ip addr show eth0Bring a specific network interface up
ip link set eth0 upTake a specific network interface down
ip link set eth0 downRouting Tables & Default Gateways
Display the kernel routing table
ip route showAdd a default gateway (e.g., routing traffic through 192.168.1.1)
ip route add default via 192.168.1.1Delete the current default gatewayip
route del defaultTrace the exact route a packet takes to reach a specific destination IP
ip route get 8.8.8.8Connectivity & Diagnostics (ICMP)
Send continuous ICMP echo requests to verify host connectivity
ping 8.8.8.8Send exactly 4 ICMP echo requests and then exit automatically
ping -c 4 google.comTrace the network hop path to a remote host with response times
traceroute google.comCombine ping and traceroute into a live, continuous path analysis tool
mtr google.comPort Scanning, Sockets, & Active Connections
Display all established active network connections
ss -atnScan a specific target host to identify open ports and services
nmap 192.168.1.1Test if a specific remote port is open using Netcat (TCP port 22)
nc -zv 192.168.1.50 22Listen on a local port to test inbound connectivity (TCP port 8080)
nc -l 8080DNS Resolution & Domain Lookups
Look up DNS records (A, MX, TXT) for a specific domain name
dig google.comPerform a quick, clean DNS lookup for a domain
host google.comPerform a reverse DNS lookup using an IP address to find the hostname
host 8.8.8.8Packet Capture & Traffic Analysis
Intercept and display raw network packets on all active interfaces
tcpdump -i anyCapture traffic on eth0, filter for port 80, and do not resolve IP addresses
tcpdump -i eth0 port 80 -nCapture network traffic and save it directly to a .pcap file for Wireshark
tcpdump -i eth0 -w capture_file.pcapWeb Requests & Remote File Transfers
Download a file over HTTP/HTTPS/FTP from a remote URL
wget https://example.comSend an HTTP request and output the raw response body to the terminal
curl https://example.comFetch and display only the HTTP response headers from a web server
curl -I https://example.comLocal Hardware & Wired / Wireless Status
Display physical link layer status, speed, and duplex settings for eth0
ethtool eth0List all wireless network interfaces and their configuration status
iwconfigScan for available Wi-Fi networks in range
iwlist wlan0 scanning