Tool cheatsheet
Linux networking Cheatsheet
Inspect interfaces, routes, ports and DNS, test connectivity, capture packets and manage firewalls with Linux networking tools.
Interfaces and routes
- Show IP addresses — List interfaces and their IP addresses. Add -br for a compact view.
- Show interface state — List interfaces and whether they are up.
- Show the routing table — List routes, including the default gateway.
- Find which route a destination uses — Show the interface and gateway used to reach an address.
- Find your public IP address — Ask an external service for your public address.
- Show the ARP table — List devices your machine has talked to on the local network.
- Add an IP address temporarily — Assign an extra address to an interface. It is lost on reboot.
- Bring an interface up or down — Enable or disable an interface.
Testing connectivity
- Check that a host answers — Send four echo requests and report replies.
- Trace the path to a host — Show each hop on the way to a destination.
- Trace with live statistics — Combine ping and traceroute into a continuously updated report.
- Test whether a port is open — Try to connect to a TCP port. -z checks without sending data.
- Time each phase of a request — Show how long DNS, connecting, TLS and the first byte took.
- Find the path MTU — Send a packet that must not be fragmented. 1472 bytes plus headers makes 1500. Reduce the size until it succeeds.
Ports and connections
- List listening ports — Show listening TCP and UDP sockets and the processes that own them.
- Find what is using a port — Show the socket and process for a port.
- Show established connections — List established TCP connections.
- Summarize socket counts — Show totals by socket state.
- List processes using a port — Show the process that has a port open.
- Scan a host's open ports — List open ports on a host. Only scan systems you own or have permission to test.
DNS
- Look up a record — Query A records. Add AAAA, MX, TXT or NS for other types.
- Get just the answer — Print only the answer values.
- Query a specific DNS server — Ask a particular resolver, to compare answers.
- Trace DNS from the root — Follow delegation from the root servers to the authoritative answer.
- Find the name for an IP address — Do a reverse DNS lookup for an address.
- Show the system resolver — Show DNS servers per interface on systems using systemd-resolved.
- Flush the DNS cache — Clear systemd-resolved's cache.
- Override a name locally — Point a host name to an address on this machine only, in /etc/hosts.
Packet capture and firewall
- Capture traffic on an interface — Print packets on an interface without resolving names.
- Capture traffic for a port — Show only traffic to or from port 443.
- Save a capture for Wireshark — Write packets to a file you can open in Wireshark.
- Show the firewall rules (ufw) — Show the status and numbered rules of Ubuntu's firewall front end.
- Allow a port (ufw) — Allow incoming SSH. Allow SSH before enabling the firewall.
- Turn the firewall on (ufw) — Enable ufw and start it at boot.
- List nftables rules — Show the active nftables ruleset.
- List iptables rules — Show the filter table rules with counters and numeric addresses.
Related cheatsheets
- Ansible 2 cheatsheet — Run ad-hoc commands and playbooks, manage inventories, roles, collections and secrets with Ansible.
- Argo CD 3 cheatsheet — Install Argo CD, define Applications declaratively, and manage sync, diffs, history and rollbacks with the argocd CLI.
- AWS CLI 2 cheatsheet — Configure credentials and manage S3, EC2, Lambda, logs, containers and secrets with the AWS CLI v2.
- Azure CLI 2 cheatsheet — Sign in and manage resource groups, VMs, web apps, storage, Kubernetes, registries and secrets with the az command.
- Bash and Linux 5 cheatsheet — Everyday shell and Linux commands for files, searching text, permissions, processes and servers.
- Claude API cheatsheet — Call Claude from Python, TypeScript or curl: messages, streaming, thinking, tools, structured output, caching, batches and error handling.