Networking Commands
The old note mixed outdated and current tools from several sources. This version keeps the same topic in a clean style with an emphasis on modern Linux commands.
Interfaces and Addresses
Legacy fallback on older systems:
Routes
Sockets and Listening Ports
ss is preferred over netstat on modern Linux systems.
Basic Reachability
ping -c 4 1.1.1.1
ping -c 4 google.com
nc -vz example.com 443
telnet example.com 25
curl -I https://example.com
DNS Commands
dig example.com
dig example.com +short
dig MX example.com +short
dig @1.1.1.1 example.com
host example.com
nslookup example.com
resolvectl query example.com
ARP and Neighbors
Packet Capture
Port Scanning and Security Testing
nmap -sn 10.0.0.0/24
nmap -p 22,80,443 example.com
nmap -sC -sV example.com
nmap --script ssl-enum-ciphers -p 443 example.com
Run nmap only where you have permission to scan.
Useful Config Files
/etc/hosts/etc/resolv.conf/etc/services/etc/networks/etc/hostname
Practice
- On Linux, start with
ip,ss,resolvectl, andtcpdump. - Keep legacy tools such as
ifconfig,route, andnetstatas fallbacks for older systems. - Separate name resolution, routing, and port issues: these are different layers of problems.