在Ubuntu上检索可用的Wifi网络

时间:2010-03-30 07:32:47

标签: linux ubuntu wifi ubuntu-9.10

我开始学习Ubuntu 9.10。如何以编程方式检索所有可用的Wifi网络?有人能举个例子吗?

2 个答案:

答案 0 :(得分:6)

sudo iwlist wlan0 scan

其中wlan0是你的wifi接口。

答案 1 :(得分:0)

为了获得更好的输出,请为每个网络从最大(-43 dBm)到最弱(-87 dBm)信号进行排序:

$ iwlist wlan0 scanning | egrep 'Cell |Encryption|Quality|ESSID' | tr '\n' ' ' | sed 's/Cell/\nCell/g' | sort -k 8 | sed 's/     / /g'

将产生以下输出:

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"