Adding WiFi Network on Raspbian-Debian from the Command Line

May 3, 2018 · 157 words · 1 minute read

If I’m taking my HP Stream 11 running Linux with me, it’s most useful when I can connect to WiFi. I keep forgetting how to do it Raspbian (which in this case is basically just Debian), as it’s one of those things I do just infrequently enough to forget.

To add a network you need the network’s name (the SSID) and the password, then add an entry to the file /etc/wpa_supplicant/wpa_supplicant.conf ( man page ). There is some pre-amble, but then to add a network, the bare minimum information you need to add is:

network={
         ssid="NetworkName"
         psk="NetworkPassphrase"
}

In mine, each was is separated by a blank line, but I’m not sure that’s essential.

Then you can run:

wpa_cli reconfigure

Which for some reason doesn’t work all of the time on the little laptop, so then doing:

sudo systemctl restart wpa_supplicant.service
sudo systemctl restart dhcpcd.service

normally gets it to detect and connect to the newly added network.