2

I have been experimenting with Linux recently and I've come across a dev argument in some commands when dealing with networks. E.g.:

  • ip link set dev wlan0 up/down
    
  • ip link set dev wlan0 address XXX
    
  • nmcli dev show wlan0
    

The ip link commands seem to work without the dev argument as well. For nmcli I think it lets the system know that I'm talking about a device, and I guess that it has a similar purpose for ip link. I'm slightly confused why it's there if it works without it though.

Did ip used to need it, but now it's "smarter" or is it something different?

0
8

For the ip command dev has no meaning. Most likely it was used as an example in the context of having to specify the actual device on which the ip command should work (like wlan0).

In the nmcli command dev is a shortcut for specifying the full option name device in the command.

1
  • 3
    Although the man page doesn't appear to mention it, the built-in help (ip link help) gives the syntax of the link set command as ip link set { DEVICE | dev DEVICE | group DEVGROUP } ... so it looks like dev is a kind of "optional keyword" in this context Jan 14 at 0:54
1

dev is shorthand for device

in this case, as has been suggested, it may be a placeholder for the device you are looking to perform operations on

when in doubt, I suggest finding via Google a few other examples of the command in question, that normally tells you whether the argument is a placeholder or actually part of the instruction.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.