Step 1: Find out the name of your WiFi adapter and wireless network

Before anything else, use the iwconfig command to display the wireless interfaces on your system and check their status

$ iwconfig

https://linoxide.com/wp-content/uploads/2020/05/1.-Display-Wi-FI-adapter.png

From the output above, we can see that we have a wireless interface labeled wlxc4e9840c3fce. This may be something else for your case. Also, from the output, we can see that we are not connected to any wireless network.

To list wireless interfaces only run the command:

$ iw dev 

# wlp2s0

https://linoxide.com/wp-content/uploads/2020/05/3.jpg

You can also check whether the interface is connected to any wireless device using the command:

$ iw interface_name link

In this case, the command will be:

$ iw wlp2s0 link

https://linoxide.com/wp-content/uploads/2020/05/4.-Check-if-link-is-connected.png

The output confirms that we are not connected to any wireless network. Let's now proceed to the next step and connect to a WiFi network.

Step 2: Connect to WiFi on the terminal

Before connecting to a WiFi network, it's prudent to perform a scan on the terminal to search the available Wireless networks. To achieve this, run the command:

$ sudo iwlist wlp2s0 scan | grep -i ESSID

https://linoxide.com/wp-content/uploads/2020/05/5.-scan-for-wireless-networks.png

The output indicates that we have 2 wireless networks at our disposal which we can connect to. We are going to connect to the 'Milky_Way' network using the nmcli command :