Skip to content
  • Command-Line Reference · Computer Networks

Command-Line Reference

LearnViaNotes @learnvianotes· 1 min read

Every networking command worth knowing from a terminal, with what it actually shows you.

Find your public IP address

Shell
$ curl ifconfig.me -s
# returns your machine's public-facing IP address

Ping — round-trip time & packet loss

$ ping google.com

PING google.com (142.250.77.238): 56 data bytes
64 bytes from 142.250.77.238: icmp_seq=0 ttl=118 time=8.518 ms
64 bytes from 142.250.77.238: icmp_seq=1 ttl=118 time=9.610 ms
...
--- google.com ping statistics ---
11 packets transmitted, 11 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 7.685/9.245/11.478/1.016 ms

DNS lookup

Shell
$ dig google.com          # full DNS resolution trace
$ man dig                 # manual / all available flags
$ dig -type=mx gmail.com  # find a domain's mail servers (MX records)

Packet capture

Shell
$ tcpdump -c 5
# captures the next 5 packets crossing a network interface, live

Quick reference table

CommandPurpose
curl ifconfig.me -sShow public IP address
ping <host>Test reachability + measure RTT
dig <domain>DNS lookup / resolution trace
tcpdump -c NCapture N live packets

Free for students and teachers

Write notes like this one

Cards for every idea, quizzes and flashcards, read aloud — on the web and your phone.

Something wrong with this note? Open it to report