WiFi設定 ( command line )
掃描ESSID
sudo iwlist wlan0 scan | grep -i ESSID
另一種命令列的方法:
https://askubuntu.com/questions/138472/how-do-i-connect-to-a-wpa-wifi-network-using-the-command-line
先修改/etc/wpa__supplicant/wpa_supplicant.conf權限
i@raspberrypi:/etc/wpa_supplicant $ ls -l
total 48
-rwxr-xr-x 1 root root 937 Sep 18 2016 action_wpa.sh
-rwxr-xr-x 1 root root 25892 Sep 18 2016 functions.sh
-rwxr-xr-x 1 root root 4696 Sep 18 2016 ifupdown.sh
-rw------- 1 root root 153 Apr 26 16:30 wpa_supplicant.conf
-rw------- 1 root root 153 Apr 26 16:05 wpa_supplicant.conf.backup
pi@raspberrypi:/etc/wpa_supplicant $ sudo chmod 777 wpa_supplicant.conf
pi@raspberrypi:/etc/wpa_supplicant $ ls -l
total 48
-rwxr-xr-x 1 root root 937 Sep 18 2016 action_wpa.sh
-rwxr-xr-x 1 root root 25892 Sep 18 2016 functions.sh
-rwxr-xr-x 1 root root 4696 Sep 18 2016 ifupdown.sh
-rwxrwxrwx 1 root root 153 Apr 26 16:30 wpa_supplicant.conf
-rw------- 1 root root 153 Apr 26 16:05 wpa_supplicant.conf.backup
透過wpa_passphrase指令寫入wifi參數
pi@raspberrypi:/etc/wpa_supplicant $ cat wpa_supplicant.conf
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=GB
network={
ssid="MySSID"
psk="MyPassword"
key_mgmt=WPA-PSK
}
pi@raspberrypi:/etc/wpa_supplicant $ sudo wpa_passphrase MyAnotherSSID MyAnotherPassword > /etc/wpa_supplicant/wpa_supplicant.conf
pi@raspberrypi:/etc/wpa_supplicant $ cat wpa_supplicant.conf
network={
ssid="MyAnotherSSID"
#psk="MyAnotherPassword"
psk=b9cb1e33a09c3ee95055b37bca12f932d4f7ea36c44bfb8f958cf2c3f721afa7
}
編輯設定檔 wpa_supplicant.conf
sudo vim /etc/wpa_supplicant/wpa_supplicant.conf
參考這篇https://www.raspberrypi.com.tw/2152/setting-up-wifi-with-the-command-line/
土炮查WiFi訊號強度/品質
handy@handy-dell ~ $ cat /proc/net/wireless
Inter-| sta-| Quality | Discarded packets | Missed | WE
face | tus | link level noise | nwid crypt frag retry misc | beacon | 22
wlan0: 0000 70. -21. -256 0 0 0 81 5552 0
或是
handy@handy-dell ~ $ iwconfig wlan0 | grep -i --color quality
Link Quality=70/70 Signal level=-22 dBm
專業查WiFi訊號強度/品質
$sudo apt-get install wavemon
WiFi 開關
$sudo ifup wlan0
$sudo ifdown wlan0
WiFi 查SSID
$iwlist scanning | grep SSID