Linux Networking Commands with Examples
As a network engineer, navigating through the labyrinth of Linux commands can be daunting. However, mastering these tools is essential for efficient network management and troubleshooting. Let's delve into each command with practical examples to solidify your understanding.
1. ifconfig:
Example: Assign an IP address to an interface
sudo ifconfig eth0 192.168.1.10 netmask 255.255.255.0
2. ip:
Example: Display information about all network interfaces
ip addr show
3. traceroute:
Example: Trace the route to a destination host
traceroute google.com
4. tracepath:
Example: Trace the path to a destination host with ICMP
tracepath google.com
5. ping:
Example: Check the connectivity to a host
ping 192.168.1.1
6. netstat:
Example: Display listening TCP ports
netstat -tuln
7. ss:
Example: Show all established connections
ss -t -a
8. dig:
Example: Query DNS records for a domain
dig google.com
9. nslookup:
Example: Lookup DNS information for a domain
nslookup google.com
10. route:
Example: Display the routing table
route -n
11. host:
Example: Resolve a hostname to an IP address
host google.com
12. arp:
Example: Display the ARP cache
arp -a
13. iwconfig:
Example: View wireless interface configuration
iwconfig wlan0
14. hostname:
Example: Display the system's hostname
hostname
15. curl or wget:
Example: Download a file from a URL using curl
curl -O http://example.com/file.tar.gz
16. mtr:
Example: Perform a continuous trace route with ping statistics
mtr google.com
17. whois:
Example: Retrieve WHOIS information for a domain
whois google.com
18. ifplugstatus:
Example: Check the status of Ethernet interfaces
ifplugstatus eth0
19. iftop:
Example: Monitor network traffic in real-time
sudo iftop -i eth0
20. tcpdump:
Example: Capture packets on a specific interface
sudo tcpdump -i eth0 -n 'tcp port 80'
Incorporating these examples into your daily workflow will help you harness the full potential of these essential Linux commands, enabling you to tackle network challenges with confidence and efficiency. Happy networking!