3

I am trying to write a terminal command to list all available WiFi Access points along with their signal strength.

The search led me to the following command:

nmcli dev wifi list

The output of this command is something like this.

The problem now is: what is the unit of the column SIGNAL? And is their any relationship with the signal strength in dBm? If so, how can I convert it to signal strength in dBm? Or any other way to list the available WiFi APs along with their signal strength in dBm. My code requires me to print this output as a table where column 1 is the ssid and the second column is its signal strength.

Note: There is a problem with the solution iwlist wlp8s0 scan is that it takes me around 2.5 seconds to run whereas nmcli dev wifi list is much faster and I need this speed in my data collection

Osama El-Ghonimy
  • 141
  • 1
  • 1
  • 4

1 Answers1

2

Or any other way to list the available WiFi APs along with their signal strength in dBm.

Please compare:

sudo iwlist scan

Here is a snip from my temporary location:

wlp3s0    Scan completed :
          Cell 01 - Address: xx:40:96:A0:E3:xx
                    Channel:11
                    Frequency:2.462 GHz (Channel 11)
                    Quality=63/70  Signal level=-47 dBm  
                    Encryption key:off
                    ESSID:"hhonors"
                    Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s
                    Mode:Master
<snip>
chili555
  • 58,968
  • 8
  • 93
  • 129
  • This is good as an answer for the question, but I actually I did not mention that my code requires me to print this output as a table where column 1 is the ssid and the second column is its signal strength – Osama El-Ghonimy Nov 11 '17 at 03:02
  • `sudo iwlist scan | grep -e ESSID -e level` A bit closer. – chili555 Nov 11 '17 at 03:43
  • Thank you, I started from this with some text processing and reached what I want. – Osama El-Ghonimy Nov 13 '17 at 22:48
  • The problem now is that that approach takes me around 2.5 seconds to run whereas `nmcli dev wifi list` is much faster and I need this speed in my data collection – Osama El-Ghonimy Nov 13 '17 at 23:30
  • 1
    Regarding the previous comment, from my own observations, though not from reading the code, I believe that `nmcli dev wifi list` just regurgitates info from the last scan. It does not trigger a fresh scan. Regarding formatting, nmcli can do this for you, e.g. `nmcli -f SSID,BSSID,SIGNAL dev wifi list`. – Gertlex Mar 10 '20 at 06:26