Easiest way is to use the Network Manager nmtui tool
It gives you a “command line GUI” to search and select your preferred WiFi network.
Alternate way is to use the iw tools.
Scan for available WiFi networks
Connect with iwconfig, replace WiFiName with your WiFi name. Note this only works with open networks.
iwconfig wlan0 essid WiFiName
You’ll need to get an address now, so run
Check if your DNS is working. If not, as a “hack” manually add it to /etc/resolv.conf and restart the networking service.
sudo echo "nameserver 22.214.171.124" >> /etc/resolv.conf sudo service networking restart
Your not supposed to manually put the nameservers in resolv.conf. But it works in a pinch.