Retrieve available Wifi networks on Ubuntu
I'm starting to learn Ubuntu 9.10. How can I retrieve all开发者_开发知识库 available Wifi networks programmatically? Can someone give an example?
sudo iwlist wlan0 scan
where wlan0
is your wifi-interface.
For a better output, sorting from greatest (-43 dBm) to weakest (-87 dBm) signals for each network:
$ iwlist wlan0 scanning | egrep 'Cell |Encryption|Quality|ESSID' | tr '\n' ' ' | sed 's/Cell/\nCell/g' | sort -k 8 | sed 's/ / /g'
Will produce the following output:
Cell 01 - Address: 20:08:ED:C3:29:F4 Quality=67/70 Signal level=-43 dBm Encryption key:on ESSID:"INFINITUM57yt"
Cell 03 - Address: 38:BC:01:94:CA:98 Quality=45/70 Signal level=-65 dBm Encryption key:on ESSID:"KATKENAKI"
Cell 15 - Address: A4:B1:E9:57:44:03 Quality=42/70 Signal level=-68 dBm Encryption key:on ESSID:"INFINITUM574403"
Cell 07 - Address: 78:D7:52:D2:70:38 Quality=37/70 Signal level=-73 dBm Encryption key:on ESSID:"palehouse"
Cell 02 - Address: C8:3A:35:14:5E:F0 Quality=35/70 Signal level=-75 dBm Encryption key:off ESSID:"Tenda_145EF0"
Cell 05 - Address: 64:70:02:A8:E8:AD Quality=35/70 Signal level=-75 dBm Encryption key:off ESSID:"ThomasJefferson"
Cell 11 - Address: D0:05:2A:99:3C:92 Quality=35/70 Signal level=-75 dBm Encryption key:on ESSID:"INFINITUM4183"
Cell 08 - Address: 9C:97:26:D3:ED:9D Quality=33/70 Signal level=-77 dBm Encryption key:on ESSID:"INFINITUMD3ED9D"
Cell 04 - Address: F8:1A:67:70:71:04 Quality=33/70 Signal level=-77 dBm Encryption key:on ESSID:"TP-LINK_707104"
Cell 14 - Address: 64:66:B3:8B:F0:C8 Quality=30/70 Signal level=-80 dBm Encryption key:on ESSID:"ola q ace robando el wifi oq ace"
Cell 12 - Address: 9C:2A:70:4B:85:D9 Quality=29/70 Signal level=-81 dBm Encryption key:off ESSID:"HP-Print-D9-LaserJet 1025"
Cell 10 - Address: F4:F2:6D:C2:7A:48 Quality=25/70 Signal level=-85 dBm Encryption key:on ESSID:"AppGarage"
Cell 13 - Address: 20:25:64:8E:B8:88 Quality=25/70 Signal level=-85 dBm Encryption key:on ESSID:"f46f84"
Cell 09 - Address: 60:E3:27:EC:CE:14 Quality=25/70 Signal level=-85 dBm Encryption key:on ESSID:"INFINITUM57yt"
Cell 06 - Address: 04:9F:CA:23:A0:00 Quality=23/70 Signal level=-87 dBm Encryption key:on ESSID:"Totalplay-F07C"
精彩评论