The generic form of an ip command is:
ip [ OPTIONS ] OBJECT [ COMMAND [ ARGUMENTS ]]where
OPTIONS is a set of optional modifiers affecting the
general behaviour of the ip utility or changing its output. All options
begin with the character '-' and may be used in either long or abbreviated
forms. Currently, the following options are available:
-V, -Version
-- print the version of the ip utility and exit.
-s, -stats, -statistics
-- output more information. If the option appears twice or more, the amount of information increases. As a rule, the information is statistics or some time values.
-f, -family followed by a protocol family
identifier: inet, inet6 or link.
-- enforce the protocol family to use. If the option is not present,
the protocol family is guessed from other arguments. If the rest of the command
line does not give enough information to guess the family, ip falls back to the default
one, usually inet or any. link is a special family
identifier meaning that no networking protocol is involved.
-4
-- shortcut for -family inet.
-6
-- shortcut for -family inet6.
-0
-- shortcut for -family link.
-o, -oneline
-- output each record on a single line, replacing line feeds
with the '\' character. This is convenient when you want to
count records with wc or to grep the output. The trivial
script rtpr converts the output back into readable form.
-r, -resolve
-- use the system's name resolver to print DNS names instead of host addresses.
1cm NB. Do not use this option when reporting bugs or asking for advice.
NB.
ip never uses DNS to resolve names to addresses.
OBJECT is the object to manage or to get information about.
The object types currently understood by ip are:
link -- network device
address -- protocol (IP or IPv6) address on a device
neighbour -- ARP or NDISC cache entry
route -- routing table entry
rule -- rule in routing policy database
maddress -- multicast address
mroute -- multicast routing cache entry
tunnel -- tunnel over IP
Again, the names of all objects may be written in full or
abbreviated form, f.e. address is abbreviated as addr
or just a.
COMMAND specifies the action to perform on the object.
The set of possible actions depends on the object type.
As a rule, it is possible to add, delete and
show (or list) objects, but some objects
do not allow all of these operations or have some additional commands.
The help command is available for all objects. It prints
out a list of available commands and argument syntax conventions.
If no command is given, some default command is assumed.
Usually it is list or, if the objects of this class
cannot be listed, help.
ARGUMENTS is a list of arguments to the command.
The arguments depend on the command and object. There are two types of arguments:
flags, consisting of a single keyword, and parameters,
consisting of a keyword followed by a value. For convenience,
each command has some default parameter
which may be omitted. F.e. parameter dev is the default
for the ip link command, so ip link ls eth0 is equivalent
to ip link ls dev eth0.
In the command descriptions below such parameters
are distinguished with the marker: ``(default)''.
Almost all keywords may be abbreviated with several first (or even single)
letters. The shortcuts are convenient when ip is used interactively,
but they are not recommended in scripts or when reporting bugs
or asking for advice. ``Officially'' allowed abbreviations are listed
in the document body.