If you're using a [Raspberry Pi](https://www.ampheo.com/c/raspberry-pi/raspberry-pi-boards) without a desktop environment (e.g., Raspberry Pi OS Lite), you can connect to a Wi-Fi network using the terminal. Follow these steps: ![capture-3-11](https://hackmd.io/_uploads/BJi3BaEwex.jpg) **1. Check Available Wi-Fi Networks** First, verify that your Wi-Fi adapter is detected and scan for available networks: ``` bash sudo iwlist wlan0 scan | grep ESSID ``` (Replace wlan0 with your Wi-Fi interface if needed, e.g., wlan1.) **2. Configure Wi-Fi Connection** Edit the Wi-Fi configuration file: ``` bash sudo nano /etc/wpa_supplicant/wpa_supplicant.conf ``` Add the following at the end of the file (replace "NETWORK_NAME" and "PASSWORD"): ``` plaintext network={ ssid="NETWORK_NAME" psk="PASSWORD" key_mgmt=WPA-PSK } ``` **For hidden networks, add scan_ssid=1:** ``` plaintext network={ ssid="HIDDEN_NETWORK" scan_ssid=1 psk="PASSWORD" } ``` Save with Ctrl + X, then Y, and Enter. **3. Restart the Wi-Fi Interface** Apply the changes and reconnect: ``` bash sudo wpa_cli -i wlan0 reconfigure ``` or ``` bash sudo ifdown wlan0 && sudo ifup wlan0 ``` **4. Verify the Connection** Check if an IP address was assigned: ``` bash ifconfig wlan0 ``` or ``` bash ip a show wlan0 ``` Test internet connectivity: ``` bash ping -c 4 google.com ``` If Wi-Fi isn’t working, restart networking: ``` bash sudo systemctl restart networking ``` **5. (Optional) Set a Static IP Address** If DHCP is unreliable, configure a static IP in /etc/dhcpcd.conf: ``` bash sudo nano /etc/dhcpcd.conf ``` Add: ``` plaintext interface wlan0 static ip_address=192.168.1.100/24 static routers=192.168.1.1 static domain_name_servers=8.8.8.8 8.8.4.4 ``` **↳ Restart DHCP service:** ``` bash sudo service dhcpcd restart ``` **Summary** ✔ iwlist scan → List available networks ✔ wpa_supplicant.conf → Configure Wi-Fi credentials ✔ wpa_cli reconfigure → Reconnect to Wi-Fi ✔ ifconfig/ping → Test connection If issues persist: ``` bash sudo systemctl restart dhcpcd sudo reboot ``` Your [Raspberry Pi](https://www.ampheoelec.de/c/raspberry-pi/raspberry-pi-boards) should now be connected to Wi-Fi!