How to Scan Wireless Networks from the Terminal on Raspberry Pi

There are several commands, some more detailed than others, for scanning the wireless spectrum from the terminal on your Raspberry Pi.

The first command I recommend shows details of all the wireless networks detected by your network adapter:

sudo iw dev wlan0 scan

if you want to scan a specific channel, you can use the following command:

sudo iw dev wlan0 scan freq 2412

where 2412 indicates the frequency 2.412 GHz (channel 1); the frequency must be entered without the decimal point.

To view the various channels and frequencies supported by your device, you can use the following command:

sudo iwlist wlan0 channel

and the result will be similar to the following:

wlan0     32 channels in total; available frequencies :
Channel 01 : 2.412 GHz
Channel 02 : 2.417 GHz
Channel 03 : 2.422 GHz
Channel 04 : 2.427 GHz
Channel 05 : 2.432 GHz
Channel 06 : 2.437 GHz
Channel 07 : 2.442 GHz
Channel 08 : 2.447 GHz
Channel 09 : 2.452 GHz
Channel 10 : 2.457 GHz
Channel 11 : 2.462 GHz
Channel 12 : 2.467 GHz
Channel 13 : 2.472 GHz
Channel 36 : 5.18 GHz
Channel 40 : 5.2 GHz
Channel 44 : 5.22 GHz
Channel 48 : 5.24 GHz
Channel 52 : 5.26 GHz
Channel 56 : 5.28 GHz
Channel 60 : 5.3 GHz
Channel 64 : 5.32 GHz
Channel 100 : 5.5 GHz
Channel 104 : 5.52 GHz
Channel 108 : 5.54 GHz
Channel 112 : 5.56 GHz
Channel 116 : 5.58 GHz
Channel 120 : 5.6 GHz
Channel 124 : 5.62 GHz
Channel 128 : 5.64 GHz
Channel 132 : 5.66 GHz
Channel 136 : 5.68 GHz
Channel 140 : 5.7 GHz
Current Frequency:2.432 GHz (Channel 5)

As you can see, the last line shows the channel currently used by the network you are connected to.

If instead you want to see a list of the wireless networks detected by your Raspberry Pi, you can use the following command:

 sudo iw dev wlan0 scan | grep SSID | sort | uniq -c | sort -n

Enjoy!

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top