Jan 25 2013

nmcli is wicked

You don't need alttext here, this image is lame filler!

Remember how happy we were when finally got clicky with nm-applet?

I don’t know about you, but I’ve been wishing, hoping and waiting (not helping or coding of course!) a long time for a useable command line client for network-manager. cnetworkmanager came and went without anyone actually trying it, and then nmcli showed up.

nmcli syntax is a little less than intuitive, and if you’re like me it took you a while to notice that the problem you were having with it was not in fact that you couldn’t figure out the syntax, it was that it would not do the thing you were trying to get it to do!
Well eventually anyway. As it turned out it; would do 2 out of 3. That is you could:
bring up or down networks that network-manager already knew about:
nmcli con down id NetworkImDoneWith
nmcli con up id MyAwesomeNetwork
In the process of figureing that one out, we all learned to list nm’s known networks:
nmcli con list
Which does’nt count as one of the three, because while it’s kind of nostalgic to see an SSID you connected to in 2009 on that work trip to Illinois, until you’re wrestling with nmcli you’d never want to do this, it’s the equivalent opening nm-connection-editor and opining over each tab.

But oh boy were you excited that day at the coffee shop when you were practicing running your whole system from a framebuffer on tty1, and discovered that nmcli could list the _new_ networks available:
nmcli dev wifi


If it can list them surely we can connect to them!

Alas, it was not to be. After plugging through all the syntactic options for nmcli and it’s dev,nm,con subcommands you gave up and hit ctrl+alt+f7 logged into to X and clickyclickyclickied on “aztec cafe” so easy and so defeating.

You knew someday you would not suffer so.

That time is now!

The nmcli that comes with network-manager 0.9.6 ( is already in debian experimental) includes the all new “wifi connect” command:

$ nmcli dev help
Usage: nmcli dev { COMMAND | help }

COMMAND := { status | list | disconnect | wifi }

list [iface ]
disconnect iface [–nowait] [–timeout ]
wifi [list [iface ] [bssid ]]
wifi connect <(B)SSID> [password ] [wep-key-type key|phrase] [iface ] [bssid ][name ][–private] [–nowait] [–timeout ]

That mess translates into, You can now finally attach to a new network:
“Hmm are there are any networks here?”
nmcli dev wifi
'JoesHouse' 00:30:DE:AD:BE:EF Infrastructure 2412 MHz 54 MB/s 67 WPA WPA2 no

“Sweet, oh wait it’s wpa, ‘Hey Joe what’s your wifi password?, Cool thanks'”
nmcli dev wifi connect JoesHouse password correcthorsebatterystaple

Effing finally. 😀

( /me is accepting wagers on whether someone mentions pkexec in the comments)