Using nmcli connecting to wireless network

I always use minimal installs on Raspberry pi because they’re quick to download and you can test most of the functionality of the device very quickly, but the downside of minimal images it doesn’t have a GUI to use the nice graphical tools which are useful to quickly connect to a wifi network configuring your network device.

This where nmcli comes in handy to quickly do anything you can do with the GUI.example to connect to a Wifi device:

List your wifi device

# nmcli radio
WIFI-HW WIFI WWAN-HW WWAN
enabled enabled enabled enabled

show device status

# nmcli device
DEVICE TYPE STATE CONNECTION 
wlan0 wifi disconnected -- 
eth0 ethernet unavailable -- 
lo loopback unmanaged --

To actually connect to a wireless Acces point:

# nmcli device wifi rescan
# nmcli device wifi list
# nmcli device wifi connect ssid-name password password

to avoid your password being recorded by bash history add –ask example:

# nmcli -ask device wifi connect ssid-name password

It should be enough to get you connected. you can also use nmcli connection to list all configured connection you have example:

# nmcli c
NAME UUID TYPE DEVICE
ens192 3e4458f1-1343-40ae-8d44-de70304125a8 ethernet ens192