Essential Linux Networking Commands Cheat Sheet


Linux
#networking#cheat-sheet#slackware

Essential Linux Networking Commands



Core Live Network Monitors

Network Statistics: See all open ports and the exact processes using them.
ss -tulnp
View raw packet streams across all active interfaces.
tcpdump -i any
View fundamental packet drop, bytes sent/received, and error statistics for your cards.
ip -s link


Standalone Monitoring Utilities

Focuses on individual IP-to-IP connection analysis. Ideal for spotting remote server hogs.
iftop
Maps active network traffic directly to local Process IDs (PIDs). Ideal for catching rogue scripts or background apps.
nethogs
Provides total interface speed curves using clean terminal ASCII graphs. Ideal for monitoring real-time speed testing.
nload
Performs persistent, background data accumulation. Ideal for tracking daily/monthly data caps against ISP allocations.
vnstat
Delivers a lightning-fast snapshot of active ports and sockets to check listening server configurations.
ss


Interface Configuration & IP Addresses

Show all network interfaces, status, and assigned IP addresses
ip addr show
Show information for a specific interface (e.g., eth0)
ip addr show eth0
Bring a specific network interface up
ip link set eth0 up
Take a specific network interface down
ip link set eth0 down


Routing Tables & Default Gateways

Display the kernel routing table
ip route show
Add a default gateway (e.g., routing traffic through 192.168.1.1)
ip route add default via 192.168.1.1
Delete the current default gatewayip
route del default
Trace the exact route a packet takes to reach a specific destination IP
ip route get 8.8.8.8


Connectivity & Diagnostics (ICMP)

Send continuous ICMP echo requests to verify host connectivity
ping 8.8.8.8
Send exactly 4 ICMP echo requests and then exit automatically
ping -c 4 google.com
Trace the network hop path to a remote host with response times
traceroute google.com
Combine ping and traceroute into a live, continuous path analysis tool
mtr google.com


Port Scanning, Sockets, & Active Connections

Display all established active network connections
ss -atn
Scan a specific target host to identify open ports and services
nmap 192.168.1.1
Test if a specific remote port is open using Netcat (TCP port 22)
nc -zv 192.168.1.50 22
Listen on a local port to test inbound connectivity (TCP port 8080)
nc -l 8080


DNS Resolution & Domain Lookups

Look up DNS records (A, MX, TXT) for a specific domain name
dig google.com
Perform a quick, clean DNS lookup for a domain
host google.com
Perform a reverse DNS lookup using an IP address to find the hostname
host 8.8.8.8


Packet Capture & Traffic Analysis

Intercept and display raw network packets on all active interfaces
tcpdump -i any
Capture traffic on eth0, filter for port 80, and do not resolve IP addresses
tcpdump -i eth0 port 80 -n
Capture network traffic and save it directly to a .pcap file for Wireshark
tcpdump -i eth0 -w capture_file.pcap


Web Requests & Remote File Transfers

Download a file over HTTP/HTTPS/FTP from a remote URL
wget https://example.com
Send an HTTP request and output the raw response body to the terminal
curl https://example.com
Fetch and display only the HTTP response headers from a web server
curl -I https://example.com


Local Hardware & Wired / Wireless Status

Display physical link layer status, speed, and duplex settings for eth0
ethtool eth0
List all wireless network interfaces and their configuration status
iwconfig
Scan for available Wi-Fi networks in range
iwlist wlan0 scanning