Understanding network commands is crucial for system administration and troubleshooting. This guide covers essential networking tools in Linux.
Table of Contents
Open Table of Contents
Basic Network Commands
Ping Command
ping -c 4 google.com
Output:
$ ping -c 4 google.com
PING google.com (142.250.190.78) 56(84) bytes of data.
64 bytes from sfo03s29-in-f14.1e100.net (142.250.190.78): icmp_seq=1 ttl=56 time=15.6 ms
64 bytes from sfo03s29-in-f14.1e100.net (142.250.190.78): icmp_seq=2 ttl=56 time=15.8 ms
64 bytes from sfo03s29-in-f14.1e100.net (142.250.190.78): icmp_seq=3 ttl=56 time=15.7 ms
64 bytes from sfo03s29-in-f14.1e100.net (142.250.190.78): icmp_seq=4 ttl=56 time=15.7 ms
--- google.com ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3005ms
rtt min/avg/max/mdev = 15.648/15.736/15.824/0.062 ms
Network Interface Information
ip addr show
ifconfig
Interactive Quiz
Question 1
What command would you use to trace the route to a website?
Click to see answer
traceroute google.com
# or
mtr google.com
Question 2
How do you check all listening ports on your system?
Click to see answer
netstat -tuln
# or
ss -tuln
Network Monitoring
Active Connections
netstat -an | grep ESTABLISHED
ss -tp
DNS Lookup
nslookup example.com
dig example.com
Practical Examples
Monitor Network Traffic
# Monitor HTTP traffic
tcpdump -i any port 80
# Check bandwidth usage
iftop -i eth0
Best Practices
- Always use timeout options for ping
- Monitor both IPv4 and IPv6
- Keep security in mind when using network tools
- Document network configurations
- Use appropriate permissions
Conclusion
Understanding network commands is essential for effective system administration and troubleshooting in Linux environments.
What’s Next in the Series?
- System Monitoring Guide
- Shell Scripting Basics
- Advanced Linux Administration