40 Powerful Linux Networking Commands You Must Know.
Last updated
Last updated
Linux networking commands are foundational for effective network management and troubleshooting, particularly in roles like DevOps and Site Reliability Engineering (SRE). This guide introduces 50 essential Linux commands, each designed to make network troubleshooting, monitoring, and configuration straightforward. Mastery of these commands can help you swiftly diagnose network issues, monitor bandwidth, and configure complex network setups with confidence.
These commands help you quickly access network configuration details.
Displays network interface information.
Example: ifconfig
Shows or manipulates IP addresses, routing, and network devices.
Example: ip address show
Displays or modifies the IP routing table, useful for managing traffic routes.
Example: route -n
Shows or sets the system’s hostname.
Example: hostname
Controls hostname settings and provides status info.
Example: hostnamectl status
Use these commands to verify connectivity to other hosts and test network routes.
Sends packets to a host to check connectivity and response times.
Example: ping google.com
Traces the path packets take to a host, helping identify delays or connectivity issues.
Example: traceroute google.com
Combines ping
and traceroute
functionalities, offering real-time network diagnostics.
Example: mtr google.com
Pings multiple hosts quickly, useful for network discovery.
Example: fping -a -g 192.168.1.1 192.168.1.254
These commands assist with domain name resolution and troubleshooting DNS issues.
Performs DNS lookups, showing detailed information about domain names.
Example: dig google.com
Interactively queries Internet name servers.
Example: nslookup google.com
Another utility for DNS lookups.
Example: host google.com
Manages DNS information and updates settings.
Example: resolvconf -u
These commands provide insights into network traffic and open connections on your system.
Displays network connections, routing tables, and interface statistics.
Example: netstat -an
Displays socket statistics, a faster alternative to netstat
.
Example: ss -tulpn
Lists open files, showing which files are being accessed over the network.
Example: lsof -i :80
Monitors bandwidth usage in real-time, visualizing data usage per interface.
Example: iftop
Visualizes incoming and outgoing network traffic.
Example: nload
Use these commands to configure network interfaces, routing tables, and traffic flow.
Tool for packet filtering and NAT configuration, used for firewall setup.
Example: iptables -L
An interactive network monitor, perfect for live traffic analysis.
Example: iptraf
Displays or modifies settings on Ethernet devices.
Example: ethtool eth0
Shows or modifies the Address Resolution Protocol (ARP) cache.
Example: arp -a
Configures wireless network interfaces.
Example: iwconfig
A command-line client for NetworkManager, used to manage connections.
Example: nmcli connection show
Text-based interface for NetworkManager, making it easy to manage network settings.
Example: nmtui
These tools help transfer data and manage files across remote systems securely.
Securely copies files between hosts.
Example: scp file.txt user@remote:/path
Downloads files from the internet non-interactively.
Transfers data to and from servers, great for testing APIs.
Connects to other systems using the TELNET protocol.
Example: telnet google.com 80
Utility for creating arbitrary TCP and UDP connections.
Example: nc -l 8080
Generates and manages SSH authentication keys.
Example: ssh-keygen -t rsa
Monitor network security, troubleshoot issues, and gather diagnostic information.
Captures network packets for analysis.
Example: tcpdump -i eth0
Scans networks for open ports and vulnerabilities.
Example: nmap -sP 192.168.1.0/24
Measures TCP and UDP bandwidth performance, useful for network performance testing.
Example: iperf -c server_ip
Manages the SSH daemon for secure remote access.
Example: service sshd restart
These commands cover specific scenarios, from adding routes to checking system stats.
Adds a new route to the routing table.
Example: route add -net 192.168.2.0 netmask 255.255.255.0 gw 192.168.1.1
Deletes a route from the routing table.
Example: route del -net 192.168.2.0 netmask 255.255.255.0
Shows summary of socket statistics.
Example: ss -s
These 40 commands provide a solid foundation for effective Linux network management, empowering you to quickly identify and resolve network issues, monitor performance, and configure network settings across multiple systems. By integrating these tools into your troubleshooting process, you’ll be better equipped to maintain reliable and secure network infrastructure.
💬 If you have any suggestions or questions, please leave a comment below! 👏 If you found this article helpful, feel free to give it a clap and share it with your friends.
Feel free to connect, and let’s continue the conversation!😊
Thank you! 🙏
Example: wget
Example: curl
YouTube:
LinkedIn:
Instagram:
·
DevOps | SRE | Carrers | Cloud | AI | Software Automation