Essential Linux Networking Commands Every DevOps Engineer Should Master
This article provides a comprehensive, step‑by‑step guide to the most important native Linux networking commands—such as hostname, host, ping, curl, ip, ss, traceroute, dig, and tcpdump—explaining their purpose, common usage examples, and key options for effective system and network troubleshooting.
Network configuration, diagnostics, and general Linux troubleshooting are essential for system administration. This guide lists the most important native Linux networking commands for developers, DevOps engineers, and SREs.
hostname
Displays or sets the system's host name. hostname Set a new host name with:
hostnamectl set-hostname aliyun01-2c2g40g3mhost
Performs DNS lookups, both forward and reverse.
host 8.8.8.8 host flashcat.cloudping
Checks reachability of a remote host and reports packet loss, round‑trip time, etc.
bytes sent/received
packets sent/received/lost
approximate round‑trip time in ms
ping <IP or DNS> ping flashcat.cloud
ping 8.8.8.8Limit the number of echo requests with -c:
ping -c 10 flashcat.cloudcurl
Transfers data from or to a server and can be used for network debugging across many protocols.
curl -v telnet://192.168.33.10:22 curl ftp://ftptest.net curl https://flashcat.cloudwget
Retrieves files from the web and can test proxy or server availability.
wget -e use_proxy=yes http_proxy=<proxy_host:port> http://externalsite.com wget flashcat.cloudip (ifconfig)
Shows and manipulates routing and network interfaces; replaces the older ifconfig. ip addr Get IP of eth0:
ip a | grep eth0 | grep "inet" | awk -F" " '{print $2}' ip show eth0 ip route
ip route listarp
Displays the ARP cache mapping IP addresses to MAC addresses.
arpss
Modern replacement for netstat, provides socket statistics quickly. ss | head -n 5 Filter by protocol:
ss -ta
ss -ua
ss -xaList listening sockets: ss -lt List established connections:
ss -t -r state establishedtraceroute
Shows the path packets take to a destination.
traceroute google.commtr
Combines ping and traceroute for real‑time network diagnostics. mtr google.com Generate a report with 10 packets:
mtr -n --report google.comdig
Queries DNS servers for any record type. dig twitter.com ANY Short output: dig google.com ANY +short Specific record types:
dig www.google.com A +short
dig google.com CNAME +short
dig google.com MX +short
dig google.com TXT +short
dig google.com NS +shortReverse lookup:
dig -x 8.8.8.8nslookup
Another DNS lookup tool similar to dig.
nslookup google.com nslookup 8.8.8.8 nslookup -type=any google.comnc (netcat)
Swiss‑army‑knife for networking; can test port connectivity.
nc -v -n 192.168.33.10 22telnet
Tests TCP connectivity to a specific port.
telnet 10.4.5.5 22route
Displays and manipulates the kernel routing table.
route
route -ntcpdump
Captures network packets for analysis.
sudo tcpdump --list-interfaces sudo tcpdump -i eth0 sudo tcpdump -i eth0 -c 10 sudo tcpdump -i anylsof
Lists open files; useful for finding which process holds a port.
lsof lsof -i :8080Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Liangxu Linux
Liangxu, a self‑taught IT professional now working as a Linux development engineer at a Fortune 500 multinational, shares extensive Linux knowledge—fundamentals, applications, tools, plus Git, databases, Raspberry Pi, etc. (Reply “Linux” to receive essential resources.)
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
