RPi4B how to scan and list available wifi networks on cmd line?

I would like to be able to check the strength of WiFi on the available networks from the command line in OSMC. This is without connecting to them but list the available ones by strength for instance.

Is this possible and if so how?

On other RPi4 devices running PiOS I can do like this, but it only shows the connected WiFi info:

iwlist wlan0 scan | grep "level="
                    Quality=70/70  Signal level=-32 dBm

But on OSMC I get this:

iwlist wlan0 scan | grep "level="
-bash: iwlist: command not found

This works to get the current connection’s strength on both OSMC and PiOS:

sudo iw wlan0 station dump | grep "signal:"
        signal:         -42 dBm

Is it possible to get a list of the available WiFi networks by ssid and MAC with their respective signal strengths on OSMC?

If so how?

Well installing iwlist (part of wireless-tools) might help

1 Like

Thanks, I did not know the package name when I tried apt policy…
Now I got as far as on the other RPi4 device running PiOS.

Next problem is that when I run it on my OSMC box after installing it via apt it just seems to list info regarding the active connection…

I had hoped to somehow get a list of all on-the-air wifi networks so I could decide which to actually use. I have several access points each with its own ssid for the same basic network…

The MyOSMC listing of available networks when setting up the connection from the GUI does not list the strength AFAICT, but a list of servers is shown notwithstanding.

So since MyOSMC GUI is capable of listing them all maybe there could be a command line version of the used command?

By the way man seems not to exist for iwlist after installation…

OSMC excludes these files to save disk space. Any of these can be found online with a web search of “app_name man page”.

Thanks a lot again!

I read the man page like that and found why the data was limited:
need to run with sudo…

So here is the resulting data:

$ sudo iwlist wlan0 scan | grep -e 'Cell ' -e 'ESSID' -e 'Quality' -e 'Frequency:'
          Cell 01 - Address: 88:D7:F6:BA:91:78
                    Frequency:2.447 GHz (Channel 8)
                    Quality=69/70  Signal level=-41 dBm
                    ESSID:"bossefiber2"
          Cell 02 - Address: C8:7F:54:4D:BE:28
                    Frequency:2.457 GHz (Channel 10)
                    Quality=34/70  Signal level=-76 dBm
                    ESSID:"bossefiber"
          Cell 03 - Address: 64:20:9F:24:A1:D7
                    Frequency:2.472 GHz (Channel 13)
                    Quality=32/70  Signal level=-78 dBm
                    ESSID:"BosseGuest"
          Cell 04 - Address: 64:20:9F:24:A1:D6
                    Frequency:2.472 GHz (Channel 13)
                    Quality=34/70  Signal level=-76 dBm
                    ESSID:""
          Cell 05 - Address: 3C:58:5D:E4:CE:D6
                    Frequency:2.412 GHz (Channel 1)
                    Quality=28/70  Signal level=-82 dBm
                    ESSID:"Tele2_E4CED6"
          Cell 06 - Address: 98:42:65:67:F8:76
                    Frequency:2.412 GHz (Channel 1)
                    Quality=34/70  Signal level=-76 dBm
                    ESSID:"Tele2_67F876"
          Cell 07 - Address: C0:C9:E3:F7:B4:CA
                    Frequency:2.417 GHz (Channel 2)
                    Quality=29/70  Signal level=-81 dBm
                    ESSID:"VMLEJ_Yousef"
          Cell 08 - Address: 06:0E:3C:59:FA:90
                    Frequency:2.417 GHz (Channel 2)
                    Quality=26/70  Signal level=-84 dBm
                    ESSID:"DIRECT-90-HP ENVY 5000 series"
          Cell 09 - Address: DC:A6:32:05:6C:DB
                    Frequency:2.442 GHz (Channel 7)
                    Quality=44/70  Signal level=-66 dBm
                    ESSID:"AGImonitor"
          Cell 10 - Address: 98:42:65:67:F8:7A
                    Frequency:5.32 GHz (Channel 64)
                    Quality=21/70  Signal level=-89 dBm
                    ESSID:"Tele2_67F876"
          Cell 11 - Address: 9A:42:65:67:F8:7B
                    Frequency:5.32 GHz (Channel 64)
                    Quality=22/70  Signal level=-88 dBm
                    ESSID:""
          Cell 12 - Address: C8:7F:54:4D:BE:2C
                    Frequency:5.56 GHz (Channel 112)
                    Quality=33/70  Signal level=-77 dBm
                    ESSID:"bossefiber"

This is what I was after, really good!
:grin: :birthday:

1 Like