The -B flag runs this as a background process. Remove this to see real-time output in order to solve problems. The -i flag denotes the physical device used for the wifi. The -c flag points to the configuration file for use.
# Automatic WiFi Connection
> wpa_cli
This has a number of commands to input. In order:
> scan
> scan_results
> add_network
This outputs a network number, e.g. '3'. This is the new network you'll work with.