ip addr # Show all interfaces
ip -4 addr # IPv4 only
ip link # Link layer info
ip route # Routing table
ip neigh # ARP table
hostname -I # All IPs
curl ifconfig.me # Public IP
Port Scanning & Listening
What's listening?
ss -tlnp # TCP listeners with process
ss -ulnp # UDP listeners
lsof -i :80 # Who's using port 80?
netstat -tulpn # Classic way
Scan ports
nmap -sT localhost # TCP connect scan
nmap -sV 192.168.1.1 # Service detection
nmap -A 192.168.1.0/24 # Aggressive scan
DNS Queries
dig example.com # Full query
dig +short example.com # Just the answer
dig @8.8.8.8 example.com # Use specific DNS
dig -x 8.8.8.8 # Reverse lookup
dig example.com ANY # All records
nslookup example.com # Simple lookup
host example.com # Another way
tcpdump -i eth0 # Capture on interface
tcpdump port 80 # Filter by port
tcpdump host 1.2.3.4 # Filter by host
tcpdump -w capture.pcap # Write to file
tcpdump -r capture.pcap # Read from file
Common filters
tcpdump 'tcp port 443'
tcpdump 'not port 22'
tcpdump 'src host 10.0.0.1'