kuznet@kaiser $ cat /tmp/ip_batch.ip # This is a comment tuntap add mode tap tap1 # This is an another comment link set up dev tap1 addr add 10.0.0.1/24 dev tap1 kuznet@kaiser $ sudo ip -b /tmp/ip_batch.ipor from standart input:
kuznet@kaiser $ cat /tmp/ip_batch.ip | sudo ip -b -
-- don't terminate ip on errors in batch mode. If there were any errors during execution of the commands, the application return code will be non zero.
-- specify maximum number of loops the 'ip addr flush' logic will attempt before giving up. The default is 10. Zero (0) means loop until all addresses are removed.
OBJECT is the object to manage or to get information about.
The object types currently understood by
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
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
list) objects, but some objects
do not allow all of these operations or have some additional commands.
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,
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.