What’s the difference between
ip link set eth0 down and
ip link set dev eth0 down ?
The difference between the commands does not appear to be documented anywhere.
There’s no difference;
dev is optional provided the device name can’t be mistaken for another keyword that the
ip command understands. For instance, if you had an interface named
bridge then you would have to use
bridge is also a keyword that
This is undocumented behavior, but it certainly appears to work.
You’ll know if you ran afoul of
ip‘s option parser if you get a (slightly grammatically incorrect) message like:
either "dev" is duplicate, or "bridge" is a garbage.
For things that absolutely must be 100% working all the time, like network configuration scripts, you should include
dev just to be sure.
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.