Network

Interfaces & IP Addresses

ip is the modern tool for everything interface-related; ifconfig is its deprecated predecessor. a is short for addr.
$ ip a
$ ip link show
$ nmcli device status
$ ifconfig -a
Identify the network hardware behind the interfaces.
$ lspci | grep -i 'network\|ethernet'
$ lshw -class network
$ ethtool eth0

Configuring Interfaces

Bring interfaces up or down and assign addresses manually (root required). Changes made with ip are gone after a reboot; make them permanent in your network manager.
$ ip link set eth0 up
$ ip link set eth0 down
$ ip addr add 192.168.1.50/24 dev eth0
Release the DHCP lease and request a new one.
$ dhclient -r eth0
$ dhclient eth0

Wi-Fi

With NetworkManager, nmcli scans, connects, and even reveals the password of the current network.
$ nmcli device wifi list
$ nmcli device wifi connect [SSID] password [password]
$ nmcli device wifi show-password
Stored Wi-Fi passwords live in NetworkManager's connection files (root required).
$ sudo grep -r "psk=" /etc/NetworkManager/system-connections/
On systems using iwd instead of NetworkManager, use iwctl.
$ iwctl station wlan0 get-networks
$ iwctl station wlan0 connect [SSID]

External IP

Your public address as seen from the internet, via HTTP or DNS.
$ curl ifconfig.me
$ dig +short myip.opendns.com @resolver1.opendns.com

Testing Connectivity

ping checks if a host answers, traceroute shows the path packets take, and mtr combines both in a live view.
$ ping [host]
$ ping -c 4 [host]
$ traceroute [host]
$ tracepath [host]
$ mtr [host]
Check whether a specific TCP port is reachable.
$ nc -zv [host] [port]
$ telnet [host] [port]
Measure raw throughput between two machines (run iperf3 -s on one, -c on the other).
$ iperf3 -s
$ iperf3 -c [serverIp]

DNS Lookups

Resolve names to addresses and back. dig +short prints just the answer; -x does a reverse lookup of an IP.
$ dig [domain]
$ dig +short [domain]
$ dig -x [ip]
$ dig MX [domain]
$ host [domain]
$ nslookup [domain]
$ resolvectl query [domain]
Look up who owns a domain or IP range.
$ whois [domain]

Downloading Files

wget downloads and resumes, curl -O saves under the remote name (-L follows redirects), aria2c and axel split downloads over parallel connections.
$ wget [url]
$ wget -c [url]
$ curl -LO [url]
$ aria2c [url]
$ axel [url]

Open Ports & Sockets

ss replaces netstat: -t TCP, -u UDP, -l listening, -n numeric, -p show the owning process (root for all processes).
$ ss -tulpn
$ netstat -tuln
$ lsof -i
$ lsof -i :80

Routing

Show the routing table, and ask which route (and source address) would be used to reach a destination.
$ ip route
$ ip route get 1.1.1.1
$ route -n

Bandwidth Usage

Live traffic per connection (iftop), per process (nethogs), per interface (nload, bmon), and long-term statistics (vnstat).

Hostname

$ hostnamectl set-hostname [newName]