ipconfig.co.uk

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

ShortcutExpands toShows
ip aip address showEvery interface with all addresses
ip a sip address showSame as above; s matches show
ip a s eth0ip address show dev eth0One interface (the dev keyword is optional)
ip a lip address listSame as show
ip -br aip -brief address showOne line per interface: the best first command
ip -c aip -color address showColour output; ip -c -br a combines both
ip -4 a / ip -6 aip -family inet addressIPv4 only / IPv6 only
ip lip link showInterfaces at layer 2: state, MTU, MAC
ip -s lip -stats link showWith packet and byte counters
ip -br lip -brief link showName, state, MAC, flags on one line
ip rip route showThe IPv4 routing table
ip -6 rip -6 route showThe IPv6 routing table
ip r g 1.1.1.1ip route get 1.1.1.1Which interface, gateway and source address reach that host
ip nip neighbour showARP/NDP cache
ip ne, ip nei, ip neighip neighbour showSame
ip -j aip -json address showJSON; add -p to pretty-print
ip -o aip -oneline address showOne line per address, for grep and awk
ip -d lip -details link showType-specific details: VLAN id, bridge state, tunnel endpoints
ip ruip rule showPolicy routing rules
ip mip maddress showMulticast memberships (not monitor)
ip moip monitorLive event stream
ip tip tunnel showIPv4 tunnels; often prints nothing
ip xip xfrmIPsec state and policy
ip -n blue aip -netns blue address showAddresses inside the network namespace blue

Shortcuts that change things

ShortcutExpands to
ip a a 192.168.1.50/24 dev eth0ip address add 192.168.1.50/24 dev eth0
ip a d 192.168.1.50/24 dev eth0ip address delete 192.168.1.50/24 dev eth0
ip a f dev eth0ip address flush dev eth0
ip a r 192.168.1.50/24 dev eth0ip address replace … (add or change)
ip l s eth0 upip link set eth0 up
ip l s dev eth0 mtu 9000ip link set dev eth0 mtu 9000
ip l a br0 type bridgeip link add br0 type bridge
ip l d br0ip link delete br0
ip r a default via 192.168.1.1ip route add default via 192.168.1.1
ip r d defaultip route delete default
ip r r default via 192.168.1.254ip route replace default via 192.168.1.254
ip r f cacheip route flush cache
ip n f allip neighbour flush all
ip n a 192.168.1.5 lladdr … dev eth0 nud permip neighbour add … nud permanent
ip netns a blueip netns add blue
ip netns e blue ip aip 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:

Linux · Terminal
ip l s
Output
Not 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

ObjectAccepted spellingsVerbs
addressa, addr, addressshow / list / lst, add, change, replace, del / delete, flush, save, restore
linkl, linkshow / list / lst, set / change, add, replace, del / delete, xstats, afstats, property
router, ro, routeshow / list / lst, get, add, append, prepend, change, replace, del / delete, flush, save, restore, showdump
neighbourn, ne, neigh, neighbor, neighbourshow / list / lst, get, add, change, replace, del / delete, flush
ruleru, ruleshow / list / lst, add, del / delete, flush, save, restore
maddressm, maddr, maddressshow, add, del
monitormo, monitorall, link, address, route, neigh, rule, netconf, nexthop
netnsnet, netnslist, add, del, exec, identify, pids, monitor, set, attach
tunnelt, tunnel, tunlshow, add, change, del, prl, 6rd
tuntaptunt, tuntap, tapadd, del, show / list
tokentok, tokenget, set, del, list
xfrmx, xfrmstate, policy, monitor
vrfv, vrfshow, exec, identify, pids
nexthopnex, nexthopshow, add, replace, del, flush, get, bucket
netconfnetc, netconfshow
mptcpmp, mptcpendpoint, limits, monitor

Options, briefly

OptionLong formEffect
-4, -6-family inet / inet6Restrict to one address family
-br-briefCompact table (addr, link, neigh)
-c-colorColour; -c=always to force when piping
-s, -s -s-statsCounters; twice for error breakdown
-d-detailsExtra per-type detail
-h-humanHuman-readable byte counts
-j, -p-json, -prettyMachine-readable output
-o-onelineOne record per line
-n NAME-netns NAMERun in a namespace
-a-allApply to all objects (e.g. ip -a netns exec ip a)
-t, -ts-timestamp, -tshortTimestamps in monitor output
-N-NumericNo name lookup for protocol/scope/table
-r-resolveResolve addresses to names (slow)
-b FILE-batchRun commands from a file
-V-VersionVersion

Related pages

Last reviewed . Command syntax verified against Windows 11, Ubuntu 24.04, macOS 15 and FreeBSD 14 unless noted otherwise.

Spotted a mistake or a switch we have missed? Every page on this site is written to be checked against real output, so please test on your own machine and compare.