Do this, assuming the standard WPA2 necured network:
sudo nano /etc/wpa_supplicant/wpa_supplicant.conf
Enter this text, replacing the details with yours (
id_str is just a comment, you can leave it as-is):
CTRL-X, then press Y, then press Enter to save.
sudo nano /etc/network/interfaces
and add this to it:
iface wlan0 inet manual
iface default inet static
is optional, if you're likely to be unplugging and replugging the adapter, and don't want to have to manually reconnect.)
Fill in the IPs with the appropriate details, or (if you don't want to deal with that,) just replace the word "static" with "dhcp" and delete everything after it.
When you've got that done, reboot and see what happens!