How do I confirm WiFi connection status in Linux?

Answer

The iw tool can be used to read the status of the device:

  # iw dev  phy#0         Unnamed/non-netdev interface                 wdev 0x2                 addr 7e:4a:78:cc:85:77                 type P2P-device                 txpower 31.00 dBm         Interface wlan0                 ifindex 7                 wdev 0x1                 addr aa:bb:cc:07:0c:b1                 ssid testAP                 type AP                 channel 11 (2462 MHz), width: 20 MHz, center1: 2462 MHz                 txpower 31.00 dBm  Managed/client mode link information:  # iw wlan0 link  Connected to aa:bb:cc:12:34:56 (on wlan0)         SSID: testAP         freq: 2462         RX: 364 bytes (2 packets)         TX: 3782 bytes (22 packets)         signal: -31 dBm         tx bitrate: 2.0 MBit/s         bss flags:      short-slot-time         dtim period:    2         beacon int:     200  AP mode to read connected client information:  # iw wlan0 station dump  Station aa:bb:cc:8b:6c:fe (on wlan0)         inactive time:  3000 ms         rx bytes:       6479         rx packets:     37         tx bytes:       9706         tx packets:     66         tx failed:      0         signal:         -44 [-44] dBm         tx bitrate:     1.0 MBit/s         rx bitrate:     65.0 MBit/s         authorized:     yes         authenticated:  yes         associated:     yes         WMM/WME:        yes         TDLS peer:      no         DTIM period:    2         beacon interval:100         short slot time:yes         connected time: 20 seconds