How to connect to Wi-Fi from Terminal using wpa_supplicant on Void Linux

Luca
2 min readMar 27, 2021

Yesterday I spent the evening installing and configuring Void Linux. I spent most of my time understanding how to connect to my Wi-Fi network from the terminal using wpa_supplicant. I had a lot of different problems then in the end, I was able to solve this problem. I have collected all the necessary steps to connect to Wi-Fi from the terminal using wpa_supplicant in this Medium blog post.

  • The first thing we have to do is to check the name of our interface. Run this command:

ip a

In my case, “wlp1s0” is the name of the Wi-Fi interface.

  • Now you have to create a configuration file to connect to Wi-Fi, execute the following command:

sudo touch /etc/wpa_supplicant/wpa_supplicant-wlp1s0.conf

  • Now we have to add two lines to the file we have just created. Run the following command:

sudo vi /etc/wpa_supplicant/wpa_supplicant-wlp1s0.conf

  • Write the following lines into the file and then save it:

ctrl_interface=DIR=/run/wpa_supplicant

update_config=1

  • You have to add the information about your wireless network to the file we have just created. Run the following command:

wpa_passphrase SSID PASSWORD >> /etc/wpa_supplicant/wpa_supplicant-wlp1s0.conf

  • Run this last command:

wpa_supplicant -B -i wlp1s0 -c /etc/wpa_supplicant/wpa_supplicant-wlp1s0.conf

  • To check your connection run:

ping google.com

--

--

Luca

Computer Science student 🎓👨🏻‍💻🎧