Setting up your WiFi via the command line is the best method, since you don’t necessary need access to the GUI (Graphical User Interface) everything you need is already right there (in your command line).
1) Accessing Your Command Line
Boot your Raspberry pi with the WiFi adapter plugged in. You can access your command line using one of the following methods:
- Having an Ethernet connection ensures that you can open an SSH client like PuTTY to establish an SSH communication
- Using the Raspberry Pi GUI to open your terminal window
2) Checking if your RPi recognizes your WiFi adapter
There are several ways to check if your WiFi adapter has been recognized. You can type:
And your wireless adapter named as wlan0 should appear as shown in the Figure below.
If you don’t see your WiFi adapter listed, you might have to install drivers for your particular WiFi adapter. I’m using the TL-WN725N and by default Raspbian doesn’t support my WiFi adapter. So I’ve followed this thread to install my drivers.
If you don’t have a WiFi adapter yet, I highly recommend purchasing the Edimax EW 7811UN. This is a good option, because Raspbian comes with its drivers installed out of the box, that ensures that your RPi recognizes that WiFi adapter.
3) Opening configuration file
Type the following command to open your configuration file:
sudo nano /etc/wpa_supplicant/wpa_supplicant.conf
4) Adding your network details
Go to the bottom of your configuration file wpa_supplicant.conf and add your network details as shown below. Replace “YOUR-SSID” and “YOUR-SSID-PASSWORD” with the details of your WiFi connection.
Now save your file by pressing Ctrl+x then y, then finally press Enter.
5) Testing your connection
You can check the status of the wireless connection using ifconfig (to see if wlan0 has acquired an IP address) and iwconfig to check which network the wireless adapter is using.
Do you have any questions? Leave a comment down below!
Thanks for reading. If you like this post probably you might like my next ones, so please support me by subscribing my blog and my Facebook Page.