Here are 40 uses of Linux commands for troubleshooting network issues:
S.No. | Command | Command Uses | Example |
---|---|---|---|
1. | ping | Checks the accessibility and latency of a network host. | ping google.com |
2. | traceroute | Traces the route that packets take to reach a destination host. | traceroute google.com |
3. | netstat | Shows network statistics, including open ports and active connections. | netstat -a |
4. | dig | Performs DNS lookups to retrieve DNS information about a domain. | dig google.com |
5. | nslookup | Queries DNS servers to obtain domain or IP address information. | nslookup google.com |
6. | route | Displays and manipulates network routing tables. | route -n |
7. | ifconfig | Displays network interface configuration details. | ifconfig |
8. | arp | Displays or modifies the ARP (Address Resolution Protocol) cache. | arp -a |
9. | iwconfig | Configures wireless network interfaces. | iwconfig |
10. | ifup | Activates a network interface. | ifup eth0 |
11. | ifdown | Deactivates a network interface. | ifdown eth0 |
12. | ssh | Opens an encrypted session to a remote server. | ssh user@remotehost |
13. | scp | Copies files securely between hosts using SSH. | scp file.txt user@remotehost:/path/to/destination |
14. | wget | Downloads files from the web. | wget https://example.com/file.txt |
15. | curl | Transfers data from or to a server using various protocols. | curl https://example.com |
16. | iftop | Monitors network bandwidth usage by displaying a list of active connections. | iftop |
17. | tcpdump | Captures and analyzes network traffic. | tcpdump -i eth0 |
18. | netcat | Established TCP/UDP connections to remote hosts. | nc remotehost 80 |
19. | host | Performs DNS lookups and displays IP address information. | host google.com |
20. | mtr | Combines the functionality of ping and traceroute. | mtr google.com |
21. | ethtool | Displays or modifies Ethernet device settings. | ethtool eth0 |
22. | iptables | Configures firewall rules. | iptables -L |
23. | ss | Displays socket statistics, including open ports and connections. | ss -a` |
24. | nmap | Scans ports and discovers network services. | nmap -p 1-1000 targethost |
25. | route | Adds or deletes default gateways. | route add default gw gatewayip |
26. | hostname | Displays or sets the hostname of a Linux system. | hostname |
27. | dig +trace | Performs a full DNS resolution trace for a domain. | dig +trace google.com` |
28. | tcpdump -n | Captures network traffic and displays IP addresses instead of hostnames. | tcpdump -n |
29. | whois | Retrieves domain registration information. | whois google.com |
30. | ip addr show | Displays detailed IP address configuration of network interfaces. | ip addr show |
31. | ip route show | Displays the routing table of a Linux system. | ip route show |
32. | netcat -l -p | Listens for incoming connections on a specific port. | nc -l -p 1234 |
33. | ip link show | Displays the state and properties of network interfaces. | ip link show |
34. | systemd-resolve | Resolves domain names and displays DNS information. | systemd-resolve google.com |
35. | ip neigh show | Displays the ARP cache table | ip neigh show |
36. | tcpdump -i | Captures network traffic on a specific interface. | tcpdump -i eth0 |
37. | iperf | Measures maximum network bandwidth between two hosts. | iperf -s (on the receiving end), iperf -c remotehost (on the sending end) |
38. | dhclient | Obtains an IP address from a DHCP server. | dhclient eth0 |
39. | dig +short | Performs a DNS lookup and outputs only the IP address. | dig +short google.com |
40. | host -t mx | Retrieves MX (Mail Exchange) records. | host -t mx google.com |