#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
Every server lives on a network. In this video, you'll learn the commands to see your network settings, test connections, look up names, and check which ports are open. All live, on a real Ubuntu server, with SSH Command. We're connected, with the Shell view open. Everything we run now is on the server's network, not yours. ip -br -4 a lists the network interfaces and their IPv4 addresses. -br means brief, and -4 means IPv4 only. lo is the loopback, always 127.0.0.1. eth0 is the real network card, with a private address. ip route show default prints the default route. The gateway is the first stop for traffic leaving this network. ping sends small test packets and times the replies. -c 4 stops after four. Here the replies take a few milliseconds, and nothing is lost: the server can reach the internet. dig looks up a name in DNS. +short prints just the answer: the IP addresses behind example.com. curl talks to web servers. -I asks for the headers only, and -s hides the progress bar. HTTP/2 200 means success. ss lists network sockets. -t is TCP, -u is UDP, -l is listening only, and -n shows numbers. Port 22 is SSH, the service you're connected through. Ports 21 and 990 are FTP. Every listening port is a door, so close the ones you don't need. nc, with -z and -v, tests whether a port is open without sending any data. Port 443 on example.com succeeded, so HTTPS is reachable. And the search bar in SSH Command has ready-made network commands. Type ping, and copy one. That's the essentials of Linux networking: ip for your settings, ping, dig and curl to test, and ss and nc for ports. The full guide is at sshcommand.com, under network commands. SSH Command is free for personal use. The link is in the description. Thanks for watching.
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