Skip to content

Essential Linux Network Commands: A Complete Guide

Published: at 01:00 PMSuggest Changes

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

  1. Always use timeout options for ping
  2. Monitor both IPv4 and IPv6
  3. Keep security in mind when using network tools
  4. Document network configurations
  5. Use appropriate permissions

Conclusion

Understanding network commands is essential for effective system administration and troubleshooting in Linux environments.


What’s Next in the Series?


Previous Post
Linux System Monitoring Guide: Master Resource Management Tools
Next Post
Linux Text Processing Guide: Master grep, sed, and awk Commands