Tag Archives: command line

command line revers to any command entered via keyboard to make our computer do special function or user’s needs.

How to Connect Wifi Using Command Line on Ubuntu/Backtrack

Instead of using GUI version of network manager (Wicd) we can use our command line to connect Wifi in backtrack / ubuntu. Here is the step :

1. Turn on your wireless card, (usually done by specific button).
2. Open terminal. enter command iwconfig.
bt# iwconfig
this is the example output

lo        no wireless extensions.

eth0      no wireless extensions.

wlan0     Iunassociated  ESSID:off/any
          Mode:Managed  Channel=0  Access Point: 00:00:00:00:00:00
          Bit Rate=0 kb/s   Tx-Power:off
          Retry:on   RTS thr:off   Fragment thr:off
          Power Management:off
          Link Quality:0  Signal level:0  Noise level:0
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:0   Missed beacon:0

it shows you that your wireless device’s name is wlan0

4. Do a scan
bt# iwlist wlan0 scan

5. Select ESSID dan enter its key
bt# iwconfig wlan0 essid ESSIDNAME key s:password

this will only work for wifi with WEP
for working with access point with WPA we need wpa-supplicant
read this article to read further:


from those link i got this post

How to connect to a wireless network from the Ubuntu command line using a WPA/WPA2 Personal key.
For this to work.. you need to have WPA-Supplicant installed … Ubuntu comes with WPA-Supplicant installed by default.
if not present, install it using this command: sudo apt-get install wpasupplicant
Ubuntu doesn’t use a root password by default …so we need to use the sudo command here.

Now we need to create 2 files: wireless-wpa.sh + wireless-wpa.conf using the vi command. For those who are not familiar with vi , I will guide you through this.

OK ..lets start: first we gonna create the wireless-wpa.sh
type: sudo vi wireless-wpa.sh
press the “i” button ones and insert text below.

#shut down interface
ifconfig $iface down

#set ad-hoc/management of wireless device
iwconfig $iface mode Managed

#enable interface
ifconfig $iface up

#stop any persistent wireless wpa2 sessions
killall wpa_supplicant

#apply WPA/WPA2 personal settings to device
wpa_supplicant -B -Dwext -i $iface -c ./wireless-wpa.conf -dd

#obtain an IP address
dhclient $iface

Now we need to save this file and quit vi…. press “esc” button ones … then type.. :wq ( you need to type the : also )
Thats done … now we gonna make the wireless-wpa.conf

type: sudo vi wireless-wpa.conf
press the “i” button ones and insert text below.

# config file using WPA/WPA2-PSK Personal key.



Now we need to save this file and quit vi…. press “esc” button ones … then type.. :wq ( you need to type the : also )
That’s also done … now we need to set the permissions for these 2 files.

sudo chmod 755 wireless-wpa.sh
sudo chmod 644 wireless-wpa.conf

Make sure you put these 2 files in the same directory anywhere you like…else it will not work.
Run the following command to make a connection to your wireless Router/Accespoint/
sudo ./wireless-wpa.sh

That’s all …. have fun!

from long example above i conclude that using GUI version of network manager will help us a lot.

source :
1. http://blog.tplus1.com/index.php/2008/06/13/how-to-connect-to-a-wireless-network-from-the-ubuntu-command-line/
2. https://help.ubuntu.com/community/WifiDocs/WPAHowTo