Connecting to wifi through command line (Lubuntu + DWM)

Hi everyone!

As you might have noticed already, I’m a big fun of DWM and for long time I had issues with wireless. Basically whenever I wanted to change to a different wireless network I had to logout from DWM, login to the Lubuntu’s default desktop manager (not even sure what it’s called) and from there switch to the new wifi. That was kind of annoying, having to close all my open applications just to set up the wifi.

I’ve tried a few times with iwconfig etc to get it working but I never managed to connect to another wifi through command line until today! How did I do that? I used nmcli tool! This seems to be the command line tool of the network manager. Here is the command I used to connect to the wifi network:

sudo nmcli dev wifi connect <wifinetworkname> password <wifipass>

That’s simple isn’t it? Enjoy!

Note: if you want to see what networks are found in range you can use the following simple command:

nmcli connection