How to connect to Wifi in Linux with nmcli

Let’s see how we can connect to a Wifi Network via Network Manager (nmcli).

First, we will have to scan the networks, nmcli will provide some useful information like SSID, Channel, Rate, Signal.

nmcli dev wifi

Scan Wifi in Linux with nmcli

If you wish to display more information you can use the “-f ALL” flag.

nmcli -f ALL dev wifi

Scan Wifi networks in Linux with nmcli full view

Now you can connect to you wireless network, in my case the SSID it’s Test-Wifi, you will be prompted for the password.

nmcli --ask dev wifi connect Test-Wifi
Password: ••••••••
Device 'wlan0' successfully activated with '14321ac3-05d5-422e-8117-ae13a9a13f76'.

You have successfully connected to the wireless network, you can display the current settings for the connection as described below:

nmcli connection show Test-Wifi

Leave a Reply

Your email address will not be published. Required fields are marked *