The Easy Way to Connect Your Raspberry Pi to Wi-Fi

Learn how to connect your Raspberry Pi to a wireless network using the command line interface. …


Updated August 18, 2023

Need help with your Raspberry Pi?
Contact Me!

Do you love silly Raspberry Pi Projects?
Check out my this YouTube Channel!


Learn how to connect your Raspberry Pi to a wireless network using the command line interface.

Raspberry Pi is a versatile and popular single board computer that can be used for various applications, including internet of things projects, home automation, gaming consoles, and more. One of the most common tasks when working with Raspberry Pi is connecting it to a Wi-Fi network. In this article, we will show you how to connect your Raspberry Pi to Wi-Fi using the command line interface.

  1. First, make sure that your Raspberry Pi has an active internet connection. You can use either an Ethernet cable or connect it to a wireless router directly with a USB Wi-Fi adapter. If you are using a Wi-Fi adapter, ensure that it is compatible with the Raspberry Pi and its drivers are properly installed.

  2. Open the terminal on your Raspberry Pi by clicking on the icon in the top left corner of the screen or pressing Ctrl + Alt + T.

  3. Type sudo raspi-config into the terminal and press Enter. This will open the Raspberry Pi Configuration tool.

  4. Navigate to Interfacing Options > Wi-Fi and select Enable. Follow the prompts to enter your Wi-Fi network name (SSID) and password, then reboot your Raspberry Pi when finished.

  5. After the reboot, open the terminal again and type sudo nano /etc/wpa_supplicant/wpa_supplicant.conf. This file contains the Wi-Fi configuration for your Raspberry Pi.

  6. Scroll down to the bottom of the file and add the following lines:

network={
    ssid="your_SSID"
    psk="your_password"
}

Replace “your_SSID” with the name of your Wi-Fi network and “your_password” with the password for that network. Save the file by pressing Ctrl + X, then Y, and Enter.

  1. Restart the Wi-Fi service by typing sudo systemctl restart wpa_supplicant.

  2. To verify that your Raspberry Pi is connected to the Wi-Fi network, type iwconfig into the terminal. You should see the IP address assigned to your device under “wlan0” (the wireless interface).

Now your Raspberry Pi is successfully connected to Wi-Fi! You can use this connection to access the internet and run programs that require an internet connection.