ip a, ip a s, ip r: the ip command shortcuts
You will see ip a, ip a s, ip r and ip n in forum answers with no explanation. They are not separate commands. ip accepts any unambiguous prefix of an object or verb, so these are just the long forms with the typing left out.
The rule
iproute2 compares what you typed against its list of objects (address, link, route, neighbour, …) and then against the verbs for that object (show, add, del, …), and accepts the first entry in its internal list that starts with what you typed. So a, ad, addr and address are identical. The list order matters when a prefix could match several names; that produces one famous surprise, covered below. Options are separate and keep their dashes: -4, -6, -br, -s, -c, -j, -o, -d.
The ones you will actually see
| Shortcut | Expands to | Shows |
|---|---|---|
ip a | ip address show | Every interface with all addresses |
ip a s | ip address show | Same as above; s matches show |
ip a s eth0 | ip address show dev eth0 | One interface (the dev keyword is optional) |
ip a l | ip address list | Same as show |
ip -br a | ip -brief address show | One line per interface: the best first command |
ip -c a | ip -color address show | Colour output; ip -c -br a combines both |
ip -4 a / ip -6 a | ip -family inet address | IPv4 only / IPv6 only |
ip l | ip link show | Interfaces at layer 2: state, MTU, MAC |
ip -s l | ip -stats link show | With packet and byte counters |
ip -br l | ip -brief link show | Name, state, MAC, flags on one line |
ip r | ip route show | The IPv4 routing table |
ip -6 r | ip -6 route show | The IPv6 routing table |
ip r g 1.1.1.1 | ip route get 1.1.1.1 | Which interface, gateway and source address reach that host |
ip n | ip neighbour show | ARP/NDP cache |
ip ne, ip nei, ip neigh | ip neighbour show | Same |
ip -j a | ip -json address show | JSON; add -p to pretty-print |
ip -o a | ip -oneline address show | One line per address, for grep and awk |
ip -d l | ip -details link show | Type-specific details: VLAN id, bridge state, tunnel endpoints |
ip ru | ip rule show | Policy routing rules |
ip m | ip maddress show | Multicast memberships (not monitor) |
ip mo | ip monitor | Live event stream |
ip t | ip tunnel show | IPv4 tunnels; often prints nothing |
ip x | ip xfrm | IPsec state and policy |
ip -n blue a | ip -netns blue address show | Addresses inside the network namespace blue |
Shortcuts that change things
| Shortcut | Expands to |
|---|---|
ip a a 192.168.1.50/24 dev eth0 | ip address add 192.168.1.50/24 dev eth0 |
ip a d 192.168.1.50/24 dev eth0 | ip address delete 192.168.1.50/24 dev eth0 |
ip a f dev eth0 | ip address flush dev eth0 |
ip a r 192.168.1.50/24 dev eth0 | ip address replace … (add or change) |
ip l s eth0 up | ip link set eth0 up |
ip l s dev eth0 mtu 9000 | ip link set dev eth0 mtu 9000 |
ip l a br0 type bridge | ip link add br0 type bridge |
ip l d br0 | ip link delete br0 |
ip r a default via 192.168.1.1 | ip route add default via 192.168.1.1 |
ip r d default | ip route delete default |
ip r r default via 192.168.1.254 | ip route replace default via 192.168.1.254 |
ip r f cache | ip route flush cache |
ip n f all | ip neighbour flush all |
ip n a 192.168.1.5 lladdr … dev eth0 nud perm | ip neighbour add … nud permanent |
ip netns a blue | ip netns add blue |
ip netns e blue ip a | ip netns exec blue ip address show |
The trap: ip l s is not "link show"
For address, route and neighbour, the verb list has show before set-like words, so s means show. For link, the list is checked in the order add, set, replace, delete, show…, so s matches set:
ip l sNot enough information: "dev" argument is required.That error is ip link set complaining that you gave it nothing to set. To show links, use ip l (show is the default verb), ip l sh, or ip -br l. Verified on iproute2 6.17; the behaviour has been the same for many years.
Other prefixes worth knowing: ip n resolves to neighbour, not netns or ntable; ip net resolves to netns, not netconf; ip m is maddress, so ip mo is needed for monitor; ip t is tunnel, so use ip tu… actually also tunnel; tuntap needs ip tunt and token needs ip tok. When in doubt, type one more letter.
The full spellings
| Object | Accepted spellings | Verbs |
|---|---|---|
| address | a, addr, address | show / list / lst, add, change, replace, del / delete, flush, save, restore |
| link | l, link | show / list / lst, set / change, add, replace, del / delete, xstats, afstats, property |
| route | r, ro, route | show / list / lst, get, add, append, prepend, change, replace, del / delete, flush, save, restore, showdump |
| neighbour | n, ne, neigh, neighbor, neighbour | show / list / lst, get, add, change, replace, del / delete, flush |
| rule | ru, rule | show / list / lst, add, del / delete, flush, save, restore |
| maddress | m, maddr, maddress | show, add, del |
| monitor | mo, monitor | all, link, address, route, neigh, rule, netconf, nexthop |
| netns | net, netns | list, add, del, exec, identify, pids, monitor, set, attach |
| tunnel | t, tunnel, tunl | show, add, change, del, prl, 6rd |
| tuntap | tunt, tuntap, tap | add, del, show / list |
| token | tok, token | get, set, del, list |
| xfrm | x, xfrm | state, policy, monitor |
| vrf | v, vrf | show, exec, identify, pids |
| nexthop | nex, nexthop | show, add, replace, del, flush, get, bucket |
| netconf | netc, netconf | show |
| mptcp | mp, mptcp | endpoint, limits, monitor |
Options, briefly
| Option | Long form | Effect |
|---|---|---|
-4, -6 | -family inet / inet6 | Restrict to one address family |
-br | -brief | Compact table (addr, link, neigh) |
-c | -color | Colour; -c=always to force when piping |
-s, -s -s | -stats | Counters; twice for error breakdown |
-d | -details | Extra per-type detail |
-h | -human | Human-readable byte counts |
-j, -p | -json, -pretty | Machine-readable output |
-o | -oneline | One record per line |
-n NAME | -netns NAME | Run in a namespace |
-a | -all | Apply to all objects (e.g. ip -a netns exec ip a) |
-t, -ts | -timestamp, -tshort | Timestamps in monitor output |
-N | -Numeric | No name lookup for protocol/scope/table |
-r | -resolve | Resolve addresses to names (slow) |
-b FILE | -batch | Run commands from a file |
-V | -Version | Version |
Related pages
- ip command reference (the long version)
- ifconfig to ip translation
- Cross-platform cheat sheet