#ip
Network addresses and routes
ip [object] [command]ip aShow interfaces and IP addresses
ip rShow the routing table
ip -br aShort, one line per interface
ipNetwork addresses and routes
ip [object] [command]ip aShow interfaces and IP addresses
ip rShow the routing table
ip -br aShort, one line per interface
pingTest if a host answers
ping [options] hostping -c 4 example.comSend four packets and stop
ping -c 4 8.8.8.8Test the internet without involving DNS
ssShow listening ports and connections
ss [options]ss -tulpnListening TCP/UDP ports and the program using each (use sudo to see all)
ss -t state establishedActive TCP connections
netstatOlder port listing
netstat -tulpnsudo netstat -tulpnSame idea as ss on older systems
curlTalk to web servers
curl [options] URLcurl https://example.comPrint the page
curl -I https://example.comOnly the response headers
curl -o file.zip https://example.com/file.zipSave to a file
curl -X POST -d '{"a":1}' -H "Content-Type: application/json" https://api.example.comSend data to an API
curl -sS https://ifconfig.meYour public IP address
wgetDownload files
wget [options] URLwget https://example.com/file.zipDownload a file
wget -c https://example.com/big.isoResume a broken download
wget -r -np https://example.com/docs/Download a folder of pages
digDNS lookups
dig [name] [type]dig example.comFull answer
dig +short example.comOnly the address
dig MX example.comMail servers
nslookupSimple DNS lookup
nslookup namenslookup example.comResolve a name
tracerouteShow the route packets take
traceroute hosttraceroute example.comEvery hop to the destination
mtr example.comLive version that also shows packet loss
ncTest ports, send raw data
nc [options] host portnc -zv example.com 443Is port 443 open?
nc -l 9000Listen on port 9000
ufwSimple firewall (Ubuntu)
sudo ufw actionsudo ufw status verboseShow the rules
sudo ufw allow 22/tcpAllow SSH
sudo ufw allow from 203.0.113.5 to any port 5432Allow one address to one port
sudo ufw enableTurn it on (allow SSH first!)
iptables / nftFirewall (advanced)
sudo iptables -Lsudo iptables -L -n -vList rules with counters
sudo nft list rulesetThe newer nftables listing
ifconfigOld interface tool
ifconfigifconfigSame as ip a on older systems
SSH Command is a desktop app for Mac, Windows and Linux that puts a real terminal, SFTP file panes, a sudo switch and a searchable Linux command finder in one window. Type what you want to do, and send the command to your server with one click.
Download free Windows commands with examples SFTP & FTP client