Essential Linux Networking Commands
1. ifconfig – Configure Network Interfaces
The ifconfig command is used to view and configure network interfaces. Although it is now replaced
by ip, it is still widely used.
Example: ifconfig eth0
This command displays the IP address, MAC address, and network configuration of eth0.
Use Case: Helps in checking and configuring network settings.
2. ip – Manage Network Interfaces
The ip command is the modern replacement for ifconfig. It allows for more advanced network
configuration and monitoring.
Example: ip addr show
Displays IP addresses and network interfaces.
Use Case: Used for network interface management, routing, and troubleshooting.
3. ping – Test Network Connectivity
The ping command helps in checking connectivity between two devices.
Example: ping google.com
Sends ICMP Echo Request packets to test network reachability.
Use Case: Used to verify if a remote host is reachable and measure latency.
4. netstat – Display Network Statistics
The netstat command is used to monitor network connections, routing tables, and statistics.
Example: netstat -an
Shows all active connections with IP addresses and port numbers.
Use Case: Helps in detecting open ports and monitoring active network connections.
5. ss – Check Network Sockets
The ss command is a faster alternative to netstat for displaying network statistics and connections.
Example: ss -tulnp
Shows listening ports, UDP/TCP connections, and process details.
Use Case: Used to monitor network connections and identify potential vulnerabilities.
6. traceroute – Track Packet Route
The traceroute command shows the path that packets take to reach a destination.
Example: traceroute google.com
Displays the hops between the source and destination with response times.
Use Case: Helps in troubleshooting slow network routes and detecting routing issues.
7. nslookup – Query DNS Records
The nslookup command is used to query Domain Name System (DNS) records.
Example: nslookup example.com
Displays the IP address and DNS details of the domain.
Use Case: Useful for DNS enumeration and troubleshooting domain name resolution.
8. dig – Advanced DNS Lookup
The dig command provides detailed DNS information.
Example: dig example.com
Retrieves DNS records like A, MX, and CNAME.
Use Case: Used for DNS reconnaissance in penetration testing.
9. whois – Domain Information Lookup
The whois command provides detailed information about a domain.
Example: whois example.com
Displays domain owner details, registration dates, and contact information.
Use Case: Helps in gathering intelligence on domain registrations.
10. curl – Transfer Data from URLs
The curl command is used to fetch data from URLs.
Example: curl -I https://example.com
Fetches HTTP headers of a website.
Use Case: Used in web security analysis and testing API endpoints.
11. wget – Download Files from the Web
The wget command is used to download files from the internet.
Example: wget https://example.com/file.zip
Downloads file.zip from the given URL.
Use Case: Useful for automating downloads and scraping web content.
12. tcpdump – Capture Network Traffic
The tcpdump command is a packet analyzer that captures network traffic.
Example: sudo tcpdump -i eth0
Captures packets from the eth0 interface.
Use Case: Used in network forensics and packet analysis.
13. nmap – Network Scanning
The nmap command is used for network discovery and security auditing.
Example: nmap -sV example.com
Performs a service version detection scan.
Use Case: Essential for ethical hacking and penetration testing.
14. arp – View ARP Table
The arp command displays ARP (Address Resolution Protocol) cache.
Example: arp -a
Shows MAC addresses and corresponding IP addresses.
Use Case: Helps in detecting ARP spoofing attacks.
15. ethtool – Display Network Interface Information
The ethtool command provides detailed information about network interfaces.
Example: ethtool eth0
Shows network speed, link status, and driver details.
Use Case: Helps in network performance tuning and troubleshooting.
Command Function Use Case
View and configure network
ifconfig Network setup
interfaces
ip Manage IP addresses and routes Advanced networking
ping Test connectivity Network troubleshooting
netstat Display network statistics Detect open ports
ss View network sockets Monitor connections
traceroute Track packet path Debugging slow networks
nslookup Query DNS records DNS troubleshooting
dig Perform DNS lookups DNS reconnaissance
whois Get domain info Domain investigation
curl Transfer data Web security testing
wget Download files Web automation
tcpdump Capture packets Network forensics
nmap Scan networks Ethical hacking
arp View ARP table Detect ARP spoofing
ethtool Check network status Performance monitoring