Linux Network Commands

Networking tools and commands

Network Info

ifconfig # network interface configuration
ip addr # show IP addresses (modern)
ip link # show network interfaces
hostname # show system hostname
hostname -I # show IP addresses

Connectivity

ping host # test connectivity
ping -c 4 host # ping 4 times
traceroute host # trace route to host
mtr host # combine ping and traceroute

DNS Lookup

nslookup domain # DNS lookup
dig domain # detailed DNS query
host domain # simple DNS lookup

Ports and Connections

netstat -tuln # listening ports
ss -tuln # socket statistics (modern)
lsof -i # list open network files
lsof -i:80 # check port 80

Download Files

wget url # download file
wget -O filename url # save as filename
curl url # transfer data
curl -O url # download file

Firewall

ufw status # check firewall status
ufw enable # enable firewall
ufw allow 22 # allow port 22
iptables -L # list firewall rules