ip -br aEvery network interface and its addresses, one line each.
-br- brief
Cheat sheet
Addresses, routes and DNS, checking whether something is reachable, and getting around with SSH.
Nothing you type here is sent. Nothing is saved, unless you switch on Remember. Privacy policy
The ip, ss and nmcli commands come with any modern Linux. dig is in dnsutils on Debian and Ubuntu
(bind-utils on Fedora, Rocky and RHEL), and nc is in netcat-openbsd (nmap-ncat).
Nothing matches that. Try fewer words, or a shorter one.
ip -br aEvery network interface and its addresses, one line each.
-brip a show eth0Everything about one interface.
ip rThe routing table. The default via line is your gateway.
ip route get 192.0.2.10Which interface and gateway this machine would use to reach an address.
ip -br linkWhich interfaces are up and which are down.
ip neighThe machines nearby that this one has talked to, with their hardware (MAC) addresses.
nmcli device statusInterfaces as NetworkManager sees them, on systems that use it (Fedora, Rocky, RHEL, desktops).
resolvectl statusWhich DNS servers each interface uses, on systems with systemd-resolved (Ubuntu and others).
dig +short example.comJust the address a name points to.
dig example.comThe full answer, with how long it's cached for (the TTL) and which server answered.
dig @1.1.1.1 example.comAsk a particular DNS server. Compare with your own to spot a stale or split answer.
dig example.com MX +shortWhere a domain's email goes. Swap MX for TXT, NS or CNAME for other records.
dig -x 192.0.2.10 +shortThe name an address points back to (reverse DNS).
getent hosts example.comWhat this machine really resolves a name to, /etc/hosts included. dig skips /etc/hosts, this doesn't.
ping -c 4 example.comFour pings, then stop. No reply doesn't always mean down: plenty of firewalls drop pings.
mtr example.comEvery hop on the way there, live, with where packets go missing. tracepath if mtr isn't installed.
nc -zv example.com 443Is a port open? Answers in a second instead of hanging like telnet.
-z-vcurl -I https://example.com/Just the response headers from a website.
curl -sS -o /dev/null -w '%{http_code} %{time_total}s\n' https://example.com/The status code and how long the page took. Run it in a loop to watch a deploy.
curl --resolve example.com:443:192.0.2.10 https://example.com:443/Test a new server before DNS points at it: connect to that address while asking for the real name.
openssl s_client -connect example.com:443 -servername example.com </dev/null 2>/dev/null | openssl x509 -noout -subject -datesWho a site's certificate is for and when it expires.
sudo ss -tulpnEverything listening for connections (TCP and UDP), and which program it is.
-tu-l-p-nss -tn state establishedThe connections open right now.
sudo lsof -i :443Which program is using a port.
ssh deploy@example.comLog in to a remote machine.
ssh -J deploy@bastion.example.com deploy@example.comLog in through a jump host (a bastion), in one step.
-Jssh -L 8080:localhost:443 deploy@example.comReach a port that's only open on the remote machine: browse to localhost:8080 here and you're talking to it there.
-Lssh-keygen -t ed25519Make yourself a new SSH key (ed25519 is the modern choice).
ssh-copy-id deploy@example.comPut your public key on a machine so you can log in without a password.
ssh-keygen -R example.comForget a machine's old host key, after it's been rebuilt and SSH starts shouting about it.
scp notes.txt deploy@example.com:Copy a file to your home folder on another machine.
rsync -avz ~/projects/ deploy@example.com:backup/Copy a folder's contents to another machine. Run it again and it only sends what changed.
-a-z/