Note -o saves to a file, -O uses the remote filename. -L follows redirects (essential for GitHub downloads). -s silences progress bar. -I fetches only headers. -k skips TLS verification (use only for debugging, never in production).
http requestapi calldownload filepost requestcurl jsonrest api
Note -c resumes a partially downloaded file. -r downloads recursively, -np prevents ascending to the parent directory, -l sets recursion depth. wget is simpler than curl for straightforward downloads and supports resuming by default.
Note -i specifies a private key file. -L sets up local port forwarding (the example tunnels a remote Postgres port to localhost:5432). -p sets a non-standard SSH port. Add -v for verbose debugging of connection issues.
remote loginssh connectport forwardssh tunnelremote server
Note -r copies directories recursively. -P (capital) specifies a non-standard port. For large or repeated transfers, rsync is preferable as it only sends differences.
copy to servercopy from serverremote copyupload filedownload from remote
Note -a is archive mode (preserves permissions, timestamps, symlinks). -v is verbose. -z compresses during transfer. --delete removes files from the destination that no longer exist in the source (be careful). Trailing slash on source matters: dir/ syncs contents, dir syncs the directory itself.
64 bytes from 142.250.80.46: icmp_seq=1 ttl=118 time=11.2 ms
--- google.com ping statistics ---
5 packets transmitted, 5 received, 0% packet loss
Note -c limits the number of pings (without it, Linux pings forever; macOS defaults to unlimited too). High time values indicate latency; packet loss indicates connectivity problems.
test connectionnetwork checkping hostlatencypacket loss
View Network Connections & Ports
syntax
ss [options]
netstat [options]
example
ss -tlnp
ss -s
netstat -tlnp
output
State Recv-Q Send-Q Local Address:Port Peer Address:Port Process
LISTEN 0 511 0.0.0.0:80 0.0.0.0:* users:(("nginx",pid=1482,fd=6))
Note ss is the modern replacement for netstat. -t shows TCP, -u shows UDP, -l shows listening sockets, -n shows numeric ports (not names), -p shows the process using it. netstat is deprecated on many systems but still widely used.
listening portsopen portsnetwork connectionswhich process on portnetstat replacement
Connection to server.example.com 443 port [tcp/https] succeeded!
Note -z scans without sending data (port check). -v is verbose. -w sets a timeout in seconds. -l listens on a port (useful for quick debugging). Netcat is invaluable for testing whether a port is open from a particular host.
check port openport scannetcattest connectionlisten port
Note +short gives concise output. @server queries a specific DNS server. Common types: A (IPv4), AAAA (IPv6), MX (mail), CNAME (alias), TXT, NS. +trace follows the full delegation chain from root servers.
dns lookupresolve domaindig querycheck dnsmx recordnameserver
View & Configure Network Interfaces
syntax
ip addr show
ifconfig
example
ip addr show eth0
ip route show
ifconfig en0
output
2: eth0: <BROADCAST,MULTICAST,UP> mtu 1500
inet 192.168.1.42/24 brd 192.168.1.255 scope global eth0
Note ip is the modern Linux tool; ifconfig is legacy but still default on macOS. 'ip addr' shows addresses, 'ip route' shows the routing table, 'ip link' manages interfaces. On macOS, the primary interface is usually en0.
ip addressnetwork interfaceshow ipifconfigrouting tablemy ip