Same information, three accents
Every host on a network has the same fundamental questions to answer: what is my address, what network am I on, who is my gateway, where do I look up names. Each operating system exposes the answers through a different command. The commands print different formats, use different field names, and sometimes split the work across multiple tools. The information underneath is the same.
On the next page you can see the same machine described three different ways. The hostname, IPv4 address, MAC, subnet mask, and IPv6 link-local address all match across the three terminals because they describe one host. The job is to learn how to read each format and to recognize the common fields as you move between systems.
When you land on a foothold host you do not get to choose which operating system you arrive on. You will pivot through Linux servers, Windows endpoints, and the occasional macOS engineering laptop. The first command after every shell is the one that answers "where am I?", and you need the right tool ready for the OS in front of you.
The three terminals, side by side
All three terminals below describe the same machine: a workstation with IPv4 address
192.168.1.100, MAC aa:bb:cc:dd:ee:ff, on the local network
192.168.1.0/24 with gateway 192.168.1.1. Click a concept in the legend
to highlight every instance of it across all three terminals at once.
The prompt tells you which OS you are on before you even type a command. Windows PowerShell shows
a path like PS C:\Users\learner>. macOS zsh shows learner@MacBook-Pro ~ %.
Linux bash shows learner@LAPTOP:~$. The trailing character is your fastest tell:
> is PowerShell, % is zsh, $ is bash, # is root.
Same concept, three field names
The same value lives under different labels in each OS. Memorize this row by row and you can eyeball any output and pull the value you need.
| What it is | Windows (ipconfig /all) | macOS (ifconfig) | Linux (ip a) |
|---|---|---|---|
| Interface name | Ethernet adapter Ethernet | en0, en1, lo0 |
eth0, wlan0, lo |
| IPv4 address | IPv4 Address | inet |
inet |
| Subnet mask | Subnet Mask (dotted decimal) | netmask (hex, e.g. 0xffffff00) |
CIDR suffix after IP, e.g. /24 |
| MAC address | Physical Address (AA-BB-CC-DD-EE-FF) | ether (aa:bb:cc:dd:ee:ff) |
link/ether (aa:bb:cc:dd:ee:ff) |
| IPv6 address | Link-local IPv6 Address | inet6 ... prefixlen |
inet6 ... /64 |
| Default gateway | Default Gateway (in the same output) | Separate: netstat -nr | grep default |
Separate: ip r show default |
| DNS servers | DNS Servers (in the same output) | Separate: scutil --dns |
Separate: resolvectl status |
| DHCP lease info | Lease Obtained / Expires | Separate: ipconfig getpacket en0 |
Separate: cat /var/lib/dhcp/dhclient.leases |
| Hostname | Host Name | Separate: hostname |
Separate: hostname or hostnamectl |
What each value tells you
Knowing the names is half the battle. Knowing what each value means is the other half.
IPv4 Address
The host's address on its current IPv4 network. Combined with the subnet mask, this determines which other hosts the machine can talk to without going through a router.
Subnet Mask
Defines which bits of the IP are the network portion and which are the host portion. A /24 mask means the first 24 bits are the network, leaving 8 bits (256 addresses) for hosts on this LAN.
MAC Address
The unique identifier of the network interface card. The first three bytes identify the manufacturer (the OUI); the last three are assigned by that manufacturer. See the next Codex page for the full anatomy.
Default Gateway
The IP address of the router that handles every packet whose destination is not on this LAN. If you can ping the gateway, you can probably reach the wider Internet through it.
DNS Servers
The servers this host asks when it needs to translate example.com into an IP. Often the same as the gateway on a home network; on enterprise networks they are usually dedicated internal resolvers.
Link-local IPv6
An auto-assigned IPv6 address used only on the local link. It is derived from the MAC address (modified EUI-64) or randomized for privacy. Useful for neighbor discovery, never for reaching the Internet.
Interface name
The local label for one physical or virtual network adapter. Modern Linux often uses predictable names like enp3s0. macOS numbers them en0, en1, en2. Windows uses descriptive names.
Loopback
A virtual interface that always exists and always answers. Useful for testing whether the network stack on the host is functional even before any cable is plugged in. ping 127.0.0.1 tests your own stack, not the network.
Common asks, three OS recipes
Beyond the basic "show me everything" commands, here are the targeted questions you will be asked most often and the fastest way to answer them on each OS.
What to remember
One command per OS
ipconfig on Windows, ifconfig on macOS, ip on Linux. The first thing you should be able to type without thinking on any of the three.
Read the prompt
The character at the end of the prompt tells you which shell you are in, which tells you which dialect of the command you need.
Field names differ
Physical Address, ether, link/ether. inet, IPv4 Address, inet. Same value, different label. Build the translation table in your head.
Gateway and DNS may be elsewhere
Windows packs everything into one output. macOS and Linux split it across several tools. Know the supplemental commands for each.
Subnet masks have three notations
255.255.255.0 in dotted decimal, /24 in CIDR, 0xffffff00 in hex. All three describe the same 24-bit mask. Learn to convert mentally.
Loopback is always there
If a host has no Ethernet, no Wi-Fi, and no cable, it still has lo / lo0 / loopback at 127.0.0.1. Useful for testing the stack itself.