Network Tools
There are many powerful command-line tools available for network troubleshooting and analysis.
Common Network Tools and Use Cases
-
ping: Used to test the reachability of a host on an Internet Protocol (IP) network.ping www.google.com -
traceroute: Used to trace the path that a packet takes to a destination host.traceroute www.google.com -
ss: Used to display network socket information. It is a modern replacement fornetstat.# List all listening TCP sockets
ss -tl -
netstat: Used to display network connections, routing tables, interface statistics, masquerade connections, and multicast memberships.# List all listening ports
netstat -tuln -
nmap: Used for network discovery and security auditing.# Scan for open ports on a host
nmap 192.168.1.1 -
curl: Used to transfer data from or to a server, using one of the supported protocols (HTTP, HTTPS, FTP, etc.).# Get the headers of a web page
curl -I www.google.com -
tcpdump: A powerful command-line packet analyzer.# Capture packets on the eth0 interface
sudo tcpdump -i eth0 -
wireshark-cli(tshark): A command-line version of the Wireshark network protocol analyzer.# Capture packets and save them to a file
sudo tshark -i eth0 -w capture.pcap