First, the wireless interface has to be activated. In this case I am using Debian and the interface name is
Step 1. Activate the wireless interface
ifconfig wlan0 up
Step 2. Scan for the wireless networks
iwlist wlan0 scan
The output should be sometshig like this:
wlan0 Scan completed : Cell 01 - Address: 00:17:53:0B:30:C0 ESSID:"linksys" Mode:Master Channel:6 Frequency:2.437 GHz (Channel 6) Quality=47/100 Signal level:-76 dBm Encryption key:on Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 6 Mb/s 12 Mb/s; 24 Mb/s; 36 Mb/s; 9 Mb/s; 18 Mb/s 48 Mb/s; 54 Mb/s Extra:tsf=0000010b1bfe2181 Extra: Last beacon: 28ms ago
Step 3. Now we take note of the target ESSID. In our case is “linksys”
iwconfig wlan0 essid "linksys"
Step 4. In case the AP requires a key, issue the following:
iwconfig wlan0 key "your wireless key"