sudo iwlist wlan0 scan
sudo nano /etc/network/interfaces
iface wlan0 inet dhcp
wpa-ssid ‘your ESSID’
wpa-psk ‘your password’
Your interfaces file should now look like this. Note that I have set a static IP address so if you still use DHCP then you will not need the static IP address settings like I have.
Restart your network connection by running
sudo /etc/init.d.networking restart
and then run
and you should notice an IP address assigned to wlan0.
Now reboot your Raspberry Pi to make sure that everything is working in order.
If your connection is up and running after the reboot, then you are all set to go wireless.