Setting up Raspberry PI 3 Wifi (Via CLI/BASH)

To all Raspberry PI Tinkerers…
I have had several people as for a how-to on setting up wifi on a Raspberry PI via command line.  It is actually quite easy.

Here is a quick tutorial I hope helps.


First, we need to open the file that controls what wifi we connect to.

sudo nano /etc/wpa_supplicant/wpa_supplicant.conf

This will open the file that controls what access points your RPI looks for.

Here is an example of how one should look (RPI3):

country=US
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
        ssid="SSID_HERE"
        psk="KEY_HERE"
        key_mgmt=WPA-PSK
}

Now that this file has been updated; we will need to reboot to ensure everything comes back up correctly.
Ensure that your RPI is connected to wifi.

Simply type: ifconfig

Then it will show all the interfaces, the wireless is usually “WLAN0”, or something that starts with a “W”.
The ethernet will usually start with an “E”, for example “ETH0” is very common.