获取已连接 WiFi 网络的详细信息

获取已连接 WiFi 网络的详细信息

我正在尝试获取我所连接的 WiFi 网络的详细信息。我已经尝试过iwlist wlan0 扫描它提供了已连接网络以及所有可用网络的详细信息。而且它还需要近 5 秒钟才能在终端中获取数据。我还尝试了iw dev wlan0 链接它提供了我所需的确切详细信息,但缺少信号质量(百分比)。那么是否有任何命令可以提供 wifi 网络的详细信息,例如Essid 名称、地址、信号质量、信号强度 (RSSI)

我尝试过的命令:

sudo iwlist wlan0 扫描,输出为

          wlan0     Scan completed :
          Cell 01 - Address: 30:5A:3A:9B:4A:A2
                    Channel:6
                    Frequency:2.437 GHz (Channel 6)
                    Quality=56/70  Signal level=-54 dBm 
                    Encryption key:off
                    ESSID:"Innova1"
                    Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s
                    Bit Rates:6 Mb/s; 9 Mb/s; 12 Mb/s; 18 Mb/s; 24 Mb/s
                              36 Mb/s; 48 Mb/s; 54 Mb/s
                    Mode:Master
                    Extra:tsf=000000012e7f4a65
                    Extra: Last beacon: 200ms ago
                    IE: Unknown: 0007496E6E6F766131
                    IE: Unknown: 010482848B96
                    IE: Unknown: 030106
                    IE: Unknown: 072A494E000101100201100301100401100501100601100701100801100901100A01100B01100C01100D0110
                    IE: Unknown: 2A0100
                    IE: Unknown: 32080C1218243048606C
                    IE: Unknown: 2D1A2C0103FF00000000000000000000000000000000000000000000
                    IE: Unknown: 3D1606000400000000000000000000000000000000000000
                    IE: Unknown: DD180050F2020101810003A4000027A4000042435E0062322F00**

另一个命令是sudo iw dev wlan0 link

输出为 **

Connected to 30:5a:3a:9b:4a:a2 (on wlan0)
SSID: Innova1
freq: 2437
RX: 18079342 bytes (101462 packets)
TX: 2279813 bytes (17536 packets)
signal: -58 dBm
tx bitrate: 43.3 MBit/s MCS 4 short GI
bss flags:  short-preamble short-slot-time
dtim period:    2
beacon int: 100**

答案1

您可以尝试nmcli d wifi不需要sudo特权的命令。这将提供一些您想要的信息,并列出所有网络,但连接的网络带有星号,因此您可以使用它grep来仅获取所需的标题和行,如下所示:

$ nmcli d wifi | grep ^\*
*  SSID                    MODE   CHAN  RATE       SIGNAL  BARS  SECURITY         
*  SKY5952D                Infra  11    54 Mbit/s  73      ▂▄▆_  WPA2 

相关内容