Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Possible Duplicate:
All commands that should be used to connect to wifi in command line

I don't need to configure my wifi card or anything. I just want to do the equivalent of a) listing the wifi devices in my neighbourhood, and b) connecting to one (and setting up the password for it) as I do in the GUI.

Surely there's a command-line command for this?

share|improve this question

marked as duplicate by Michael Mrozek Nov 11 '11 at 19:03

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

    
See: unix.stackexchange.com/questions/9818/… –  jasonwryan Nov 11 '11 at 17:50
    
Surely there's something simpler than the answer in that question? –  interstar Nov 11 '11 at 22:00

2 Answers 2

I'll assume wlan0 is the name of your wireless device.

  1. Bring the device up: ifconfig wlan0 up.

  2. List the wireless networks with iwlist wlan0 scan | less and find the network you want to connect to.

  3. Use wpa_supplicant to associate and connect with the network.

    a) Create a config file for wpa_supplicant, containing encryption information about the network. See man wpa_supplicant.conf for examples. Try with simplest entries first.

    b) Run wpa_supplicant -Dwext -iwlan0 -c/etc/wpa_supplicant.conf (as root; assuming /etc/wpa_supplicant.conf is the name of the config file). If it works, run it in the background and redirect the output somewhere (I just dump it to /dev/null.)

  4. Use dhclient wlan0 or dhcpcd wlan0 to obtain IP.

  5. PROFIT!

share|improve this answer
    
Doesn't seem I have wpa_supplicant on my machine. :-( –  interstar Nov 11 '11 at 22:39
    
Well, then just install it! You'll certainly find it in your distro's repositories. –  rozcietrzewiacz Nov 11 '11 at 23:22
    
@interstar Just type yum install wpa_supplicant and you will have it. –  jflory7 Apr 2 at 22:57

There's also wicd, which has a text-mode menu-driven frontend wicd-curses which lists the networks and does the setting and dhcp stuff for you.

share|improve this answer
    
Don't seem to have wicd either. –  interstar Nov 11 '11 at 22:39

Not the answer you're looking for? Browse other questions tagged or ask your own question.