Skip to content
shellmap

ipModern Linux network utility — addresses, links, routes, neighbours across all 5 shells

Equivalents in every shell

Bashunix
ip addr show

Subcommands abbreviated: `a`=addr, `l`=link, `r`=route, `n`=neigh. `ip a` lists addresses; `ip link` shows physical/virtual interfaces; `ip route` shows the routing table; `ip neigh` is the ARP/NDP cache. Modify with `ip addr add 192.168.1.10/24 dev eth0`, `ip link set eth0 up`, `ip route add default via 192.168.1.1`. Replaces all of `ifconfig` + `route` + `arp` from the legacy `net-tools`.

Zshunix
ip addr show

Same `iproute2` binary on Linux. macOS does NOT ship `ip` — use `ifconfig` for addresses/links, `netstat -nr` for routes, `arp -a` for the neighbour cache. The portable cross-platform way to ask "what is my IP?" is `hostname -I` (Linux) vs `ipconfig getifaddr en0` (macOS).

Fishunix
ip addr show

Same external. Fish completion for `ip` is good — TAB after `ip ` suggests every top-level subcommand; TAB after `ip link set ` lists interface names from `/sys/class/net/`. JSON output for scripts: `ip -j addr show | jq` (since iproute2 4.13, 2017) — much safer than parsing the columnar default.

PowerShellwindows
Get-NetAdapter; Get-NetIPAddress

No single cmdlet covers what Linux `ip` does. Address-level: `Get-NetIPAddress` / `New-NetIPAddress -InterfaceIndex 5 -IPAddress 192.168.1.10 -PrefixLength 24`. Link-level: `Get-NetAdapter` / `Enable-NetAdapter` / `Disable-NetAdapter`. Route-level: `Get-NetRoute` / `New-NetRoute`. Neighbour cache: `Get-NetNeighbor`. Each lives in the `NetTCPIP` / `NetAdapter` modules — Windows-only.

cmd.exewindows
ipconfig /all

cmd has no unified equivalent. Address info: `ipconfig` (basic) or `ipconfig /all` (DNS, DHCP lease, MAC). Routing: `route print`. Neighbours: `arp -a`. Renew DHCP: `ipconfig /release && ipconfig /renew`. Flush DNS cache: `ipconfig /flushdns`. The modern Windows replacement for ALL of these is the PowerShell `Net*` cmdlets.

Worked examples

Show all interface IP addresses

Bash
ip -4 addr show
PowerShell
Get-NetIPAddress -AddressFamily IPv4 | Select-Object InterfaceAlias, IPAddress, PrefixLength
cmd.exe
ipconfig

Add a static IP to an interface

Bash
sudo ip addr add 192.168.1.10/24 dev eth0
PowerShell
New-NetIPAddress -InterfaceAlias Ethernet -IPAddress 192.168.1.10 -PrefixLength 24
cmd.exe
netsh interface ip set address "Ethernet" static 192.168.1.10 255.255.255.0

Bring an interface up / down

Bash
sudo ip link set eth0 up
PowerShell
Enable-NetAdapter -Name Ethernet
cmd.exe
netsh interface set interface "Ethernet" enable

Gotchas

  • `ip` is LINUX-ONLY — installed by `iproute2`, missing on macOS and BSD by default. Some macOS package collections (Homebrew `iproute2mac`) provide a partial port, but coverage is incomplete. For cross-Unix scripts, prefer `ifconfig` + `netstat -nr` + `arp -a` (the lowest common denominator), or branch on `uname`.
  • The columnar default output of `ip a` is NOT machine-parseable reliably across iproute2 versions — columns shift, IPv6 addresses sometimes wrap. Use `ip -j addr` (JSON) and pipe to `jq` for any scripted parsing. iproute2 added JSON output in 4.13 (2017) — RHEL 7 and Ubuntu 16.04 are too old for it.
  • Changes made with `ip` are NOT persistent across reboots. To persist them, edit the distro's network config (`/etc/netplan/*.yaml` on modern Ubuntu, `/etc/NetworkManager/system-connections/*` on RHEL/Fedora, `/etc/network/interfaces` on Debian classic, `systemd-networkd` `.network` files elsewhere). The `ip` command is for live config; the YAML/INI files are for boot-time config.
  • PowerShell `New-NetIPAddress` does NOT persist either — it writes to the live config AND the registry, so the new IP survives reboot UNLESS the interface is DHCP-configured (DHCP renewal will overwrite). To make the change durable, also call `Set-NetIPInterface -Dhcp Disabled` to switch the interface to static mode.
  • On systems with multiple default routes (e.g. VPN up + LAN up + WiFi up), `ip route get 8.8.8.8` is the right command to determine which one Linux will actually use for outbound traffic. The first line of `ip route show default` shows the route with the LOWEST metric — but the kernel's actual routing decision involves source-address selection, policy routing, and per-process namespaces.

WSL & PowerShell Core notes

pwshOn Linux/macOS pwsh, `Get-NetAdapter` / `Get-NetIPAddress` / `Get-NetRoute` are NOT available — the `NetTCPIP` module is Windows-only because it wraps WMI / CIM `MSFT_NetIPAddress`. Use `& ip a` on Linux pwsh, `& ifconfig` on macOS pwsh. For cross-platform IP enumeration: `[System.Net.NetworkInformation.NetworkInterface]::GetAllNetworkInterfaces()` works on every pwsh — pure .NET, no native dependencies.
WSLInside WSL2 `ip addr show` lists the VM's virtual interfaces (typically `eth0` on a virtual switch managed by Hyper-V) — these are NOT the Windows-host interfaces. The Windows host has its own `vEthernet (WSL)` adapter visible via `Get-NetAdapter`. WSL's outbound traffic NATs through the host; inbound from Windows uses the WSL VM's IP, which changes every WSL restart unless `[wsl2] networkingMode=mirrored` is set in `.wslconfig` (Windows 11 22H2+).

Common tasks using ip

Related commands