3

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.

Nico
  • 429
  • 5
  • 12

1 Answers1

8

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 dev as bridge is also a keyword that ip uses.

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.

Michael Hampton
  • 244,070
  • 43
  • 506
  • 972
  • as much as i love ip cmd over ifconfig/netstat/route/etc, i always wondered why it is so leniant with syntax.... (i wish "ip" would exist on freebsd) – nandoP Jan 16 '15 at 03:06