Using Ethernet cable to connect with the Internet is too old fashion and does not provide mobility. So the best option we have is to connect Raspberry Pi To WiFi network. This article will help you connect your Raspberry Pi to Wifi network via the command line in your Raspberry Pi. We assume you have already set up your Raspberry Pi, if not then visit this link if you want to headless setup Raspberry Pi in a matter of time.

raspberry-pi-wifi-dongle

This is a very easy trick and has only a few steps (commands). Let’s get you to familiarize with the whole process.

In this article, we will show you how you can get the list of the WiFi networks that you can connect your RaspberryPi too from the terminal only. After that, we will update one network configuration file in the RaspberryPi system files to allow it to connect automatically to the WPA network whenever it restarts without asking for the password every time. Please keep in mind that to if you don’t know the password of the network then this article won’t be able to help you to connect your RaspberryPi to the required WiFi network. Once you successfully update the file, RaspberryPi automatically would try to the network or else you can force the connection process by restarting the RaspberryPi if you don’t have enough patience.

So let’s get started.

Step 1: Turn Raspberry Pi ON and start it’s terminal or any terminal which is connected to the Raspberry Pi (If you are using it headlessly).

SSH Connection to Raspberry Pi and Macbook

Step 2: Enter the command given below in the command line to list all available WiFi networks to find your network’s ESSID.

sudo iwlist wlan0 scan

Wifi Network List

Step 3: Find or trace your network’s ESSID by find option in terminal or manually to copy it so there will be no chances of failure.

Step 4: Open the WPA-supplicant configuration file in nano.

sudo nano /etc/wpa_supplicant/wpa_supplicant.conf

Add network information to connect to Wifi in Raspberry Pi

Step 5: Add the code given below at the end of the file with correct information.

network={
    ssid="testing"
    psk="testingPassword"
}

Step 6: Now press Ctrl + X Exit the File.

Step 7: It will ask to save the changes or not, Press to save the changes in the file. Then Hit Enter/Return.

Step 8: That’s all. Your work is over.

After a few seconds, the wpa-supplicant file will notice some changes have occurred so it will try to connect to the network.

NOTE: Don’t forget to attach WiFi Connector to your Raspberry Pi else it won’t be able to connect to WiFi.

If it is not getting connected and you want to force connect, then reboot your Raspberry Pi with sudo reboot command in the command line.

If Raspberry Pi is still not connected To WiFi network, check your password and ESSID are correct.

If you have any query related to this article then feel free to ask in the comment section. We will be glad to help you out.

Thank You & Stay Techie…

About Parth Kheni

Avatar for Parth KheniA Computer Engineer by profession, Parth Kheni is the Founder of TechMuzz. He is an ardent techie and crazy about gadgets. He feels that the apt use of technology simplifies the life to a great extent and thus wishes to take it at every doorstep.

Pin It on Pinterest

Share This