Networking & SSH EssentialsLesson 5.1
Linux networking commands every developer needs
ip addr, ifconfig, ping, traceroute, netstat, ss, hostname, /etc/hosts, DNS lookup with dig and nslookup
Network Diagnostics From the Command Line
Network issues are a constant part of server work. These commands let you diagnose connectivity problems, check open ports, and inspect DNS — without needing a GUI.
IP Configuration and Connectivity
# Show all network interfaces and their IP addresses
ip addr show
# Older equivalent (deprecated but still common)
ifconfig
# Test connectivity to a host
ping -c 4 google.com
# Trace the route packets take
traceroute google.com
# Your system's hostname
hostnameChecking Open Ports and Connections
# List all listening ports (modern tool)
ss -tlnp
# Older equivalent
netstat -tlnp
# Check if a specific port is open
ss -tlnp | grep :8080
# Check what process is using port 80
ss -tlnp | grep :80DNS Lookups
# Forward lookup: domain to IP
dig google.com
# Short answer only
dig +short google.com
# Reverse lookup: IP to domain
dig -x 8.8.8.8
# Check specific DNS record types
dig google.com MX
dig google.com NS
# Simpler alternative
nslookup google.com
# Add a custom hostname (for dev environments)
echo "127.0.0.1 myapp.local" | sudo tee -a /etc/hosts