Connect Raspberry Pi to wifi using the command line (Raspbian)


Step 1. Boot the Raspberry Pi to command line.

Step 2.

sudo nano /etc/network/interfaces

Then edit the file to look like this, adding the details for your SSID (wifi name) and password:

auto lo iface lo inet loopback iface eth0 inet dhcp allow-hotplug wlan0 auto wlan0 iface wlan0 inet dhcp wpa-ssid "ssid" wpa-psk "password"

Step 3. When you have finished press ctrl-x. This will ask if you want to save the modified files. Press ‘Y’ and then Return to save the file with the same name.

Step 4.

sudo reboot