Skip to content
shellmap

ifconfigConfigure network interfaces — addresses, MTU, flags across all 5 shells

Equivalents in every shell

Bashunix
ifconfig

From 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.

Zshunix
ifconfig

Same 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.

Fishunix
ifconfig

Same 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.

PowerShellwindows
Get-NetIPAddress | Format-Table InterfaceAlias, IPAddress

Same 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.

cmd.exewindows
ipconfig

NOT 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

Bash
ifconfig
Zsh
ifconfig
PowerShell
Get-NetIPAddress | Format-Table InterfaceAlias, IPAddress, PrefixLength
cmd.exe
ipconfig

Bring an interface up / down

Bash
sudo ifconfig eth0 up
Zsh
sudo ifconfig en0 up
PowerShell
Enable-NetAdapter -Name Ethernet
cmd.exe
netsh interface set interface "Ethernet" enable

Assign a static IP to an interface

Bash
sudo ifconfig eth0 192.168.1.10 netmask 255.255.255.0
Zsh
sudo ifconfig en0 inet 192.168.1.10 netmask 255.255.255.0
PowerShell
New-NetIPAddress -InterfaceAlias Ethernet -IPAddress 192.168.1.10 -PrefixLength 24

Gotchas

  • 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

pwshSame as `ip`: on Linux/macOS pwsh, the Windows-only `Get-NetAdapter` / `Get-NetIPAddress` cmdlets are absent. Shell out: `& ifconfig` on macOS pwsh, `& ip a` on Linux pwsh (since `ifconfig` may not be installed on minimal Linux). Pure-.NET cross-platform fallback: `[System.Net.NetworkInformation.NetworkInterface]::GetAllNetworkInterfaces()`.
WSLInside WSL `ifconfig` shows the WSL VM's virtual interfaces — typically `eth0` and `lo`. It is NOT installed by default on Ubuntu / Debian WSL images since 2020 (use `sudo apt install net-tools` first, or just use `ip`). To see Windows-side network adapters from WSL: `ipconfig.exe /all` (yes, the `.exe` works from WSL bash, the same way `notepad.exe` does).

Common tasks using ifconfig

Related commands