wpa_cli Tool

wpa_cli is a text based front-end program used to communicate with wpa_supplicant. It is used to check the current state, change configuration, trigger events, and request interactive user input.

In addition, it can be used to configure variables such as EAPOL state machine parameters and trigger events such as re-association and IEEE 802.1X logout/login.

wpa_cli has many functions, which can be seen through execute wpa_cli -h command. The following list are some example commands:
  • Check the WLAN status:
    wpa_cli -p/var/run/wpa_supplicant -iwlan0 status
  • Scan the nearby WLAN:
    wpa_cli -i wlan0 scan
  • Scan the nearby WLAN and list the devices:
    wpa_cli -i wlan0 scan_result
  • View all accessible networks and the currently connected network:
    wpa_cli -i wlan0 list_networks
  • Obtain an ID that stores the WLAN structure, assuming 1:
    wpa_cli -i wlan0 add_network
  • Set the hotspot SSID with ID 1:
    wpa_cli -i wlan0 set_network 1 ssid '"HO4428"'
  • Set the password for the hotspot with ID 1:
    wpa_cli -i wlan0 set_network 1 psk '"442701102"'