Yash Verma / Cloud runbook

Networking commands

17 commands from the cloud runbook. Fill in a placeholder once and every command uses it.

Fetch HTTP headers only

Fetches only the HTTP response headers.

curl -I https://example.com

http, curl, headers

Trace DNS resolution path

Follows the DNS delegation path from root servers.

dig +trace <domain>

dns, dig

Test TCP port connectivity

Uses netcat to check if a remote TCP port is reachable.

nc -vz <hostname> <port>

tcp, connectivity, nc

Capture packets on port

Captures and displays raw network traffic on a specific port.

sudo tcpdump -i any port 80 -n -v

tcpdump, packets, sniffing

Check a remote TLS certificate's expiry

Fetches and displays the expiration date of a remote SSL certificate.

echo | openssl s_client -servername example.com -connect example.com:443 2>/dev/null | openssl x509 -noout -dates

ssl, tls, certificate

Format JSON with jq

Fetches a JSON API response and formats it nicely using jq.

curl -s https://api.github.com/users/octocat | jq '.'

curl, jq, json

Test Nginx configuration

Tests the Nginx config files for syntax errors before reloading.

sudo nginx -t

nginx, config, test

Reload Nginx gracefully

Reloads the Nginx configuration without dropping active connections.

sudo nginx -s reload

nginx, reload

Monitor Nginx access logs

Tails the Nginx access logs and uses awk to show only IPs and HTTP status.

tail -f /var/log/nginx/access.log | awk '{print $1, $9}'

nginx, logs, awk

Check IP routing

Determines exactly which interface and route will be used to reach an IP.

ip route get 8.8.8.8

route, ip

Ping via specific interface

Forces ping to use a specific network interface.

ping -I eth1 8.8.8.8

ping, interface

Network path analysis (mtr)

Combines ping and traceroute for real-time network path analysis.

mtr --report <hostname>

mtr, traceroute, latency

List iptables rules

Shows all current iptables firewall rules with line numbers.

sudo iptables -L -n -v --line-numbers

iptables, firewall, rules

DNS lookup

Queries a DNS server to resolve a domain name.

nslookup <domain> 8.8.8.8

dns, nslookup, resolve

Mirror a website with wget

Downloads an entire website for offline browsing.

wget --mirror --convert-links --page-requisites <url>

wget, download, mirror

Send POST request with JSON

Sends a JSON payload to an API endpoint.

curl -X POST -H "Content-Type: application/json" -d '{"key":"value"}' https://api.example.com/endpoint

curl, post, api

WHOIS domain lookup

Fetches domain registration information.

whois example.com

whois, domain, dns