ifconfig — Configure network interfaces — addresses, MTU, flags across all 5 shells
Equivalents in every shell
ifconfigFrom the `net-tools` package — DEPRECATED on most Linux distros since ~2010 in favor of `iproute2`'s `ip` command, but still installed nearly everywhere for backward compatibility. `ifconfig` (no args) lists all UP interfaces; `ifconfig -a` lists all (including DOWN). On Linux it cannot show all the things `ip` can — IPv6 scope IDs, multipath routes, VRF associations.
ifconfigSame external. On macOS `ifconfig` is the PRIMARY tool (no `ip` available by default). Syntax differs slightly between Linux `net-tools` `ifconfig` and BSD-derived macOS `ifconfig` — e.g. macOS uses `ifconfig en0 alias 10.0.0.5/24` for adding a secondary address; Linux uses `ifconfig eth0:0 10.0.0.5`. Both are now considered legacy ways to do this.
ifconfigSame external. `ifconfig en0 down` followed by `ifconfig en0 up` is the macOS recipe for forcing DHCP renewal (faster than digging into System Preferences). Fish autocompletion for `ifconfig` is more limited than `ip` — it does not auto-suggest interface names.
Get-NetIPAddress | Format-Table InterfaceAlias, IPAddressSame Windows `NetTCPIP` cmdlets as `ip` covers above. There is no `ifconfig.exe` on Windows by default — `ipconfig.exe` is the closest cmd-side tool, and `Get-NetIPAddress` / `Get-NetAdapter` are the PowerShell answer. Inside Git for Windows or Cygwin, an `ifconfig` shim may be available, but it usually reports only loopback + the Cygwin pseudo-interface.
ipconfigNOT a typo — Windows uses `ipconfig` (no "f"). Shows IP, subnet mask, default gateway per adapter. `ipconfig /all` adds MAC address, DHCP server, DNS servers, lease times. `ipconfig /release` / `ipconfig /renew` for DHCP refresh; `ipconfig /flushdns` clears the resolver cache. Windows has never shipped a `ifconfig` of any kind.
Worked examples
Show all interface IP addresses
ifconfigifconfigGet-NetIPAddress | Format-Table InterfaceAlias, IPAddress, PrefixLengthipconfigBring an interface up / down
sudo ifconfig eth0 upsudo ifconfig en0 upEnable-NetAdapter -Name Ethernetnetsh interface set interface "Ethernet" enableAssign a static IP to an interface
sudo ifconfig eth0 192.168.1.10 netmask 255.255.255.0sudo ifconfig en0 inet 192.168.1.10 netmask 255.255.255.0New-NetIPAddress -InterfaceAlias Ethernet -IPAddress 192.168.1.10 -PrefixLength 24Gotchas
- On modern Linux distros (RHEL 8+, Ubuntu 18.04+, Debian 10+) `ifconfig` is in a separate package — `apt install net-tools` — and may not be installed by default in container images. Scripts that assume `ifconfig` exists fail on minimal images. The portable Linux answer is `ip`.
- Linux `ifconfig` truncates RX/TX byte counters at 4 GB (32-bit unsigned) — high-traffic interfaces will roll over multiple times per day, making `ifconfig`-based bandwidth monitoring useless. `ip -s link show` exposes 64-bit counters; `/sys/class/net/<iface>/statistics/rx_bytes` is the lowest-level read.
- macOS `ifconfig` reports interfaces in a different naming scheme than Linux — `en0` (Wi-Fi or built-in Ethernet depending on hardware), `en1`, `awdl0` (AirDrop), `utun0` (tunnel pseudo-interface). Scripts that hard-code `eth0` break on macOS. `route get default` / `route -n get default` extracts the active outbound interface name.
- Both Linux `ifconfig` and macOS `ifconfig` mix IPv4 and IPv6 lines per interface — the default output is human-readable, not machine-parseable. For scripts use `ip -j` on Linux, or `ifconfig -L en0 | awk '/inet /{print $2}'` patterns on macOS. Or just call `system_profiler SPNetworkDataType -json` (macOS) for full structured output.
- On Windows, `ipconfig` does not need admin — it reports what the user can see. But `ipconfig /release` and `/renew` DO need admin because they talk to the DHCP client service. Without admin they error with "The requested operation requires elevation".
WSL & PowerShell Core notes
Common tasks using ifconfig
- Get the local IP address
Find the IPv4 address your machine is using on the local network — for sharing dev servers, configuring peers, and debugging "why can't my phone reach my laptop".
- Get the MAC address of a network interface
Print the hardware (link-layer) address of one or all network interfaces — for license-binding, WoL setup, DHCP reservation matching, inventory audits, or diagnosing why a switch port shows an unexpected device.