Tuesday, 29 September 2015

How to connect to WiFi using command line Ubuntu, Debian etc.

Tried to upgrade to Ubuntu 15.10 Beta 2, rebooted  and my system was broken. Could not connect to LAN, so my only option was to connect to Wifi via command line to hopefully repair my system.

This is what I did.

First, open a terminal:

Ctrl-Alt-T

If you got WPA like me you need wpa_supplicant to set it up, because iw can only handle WEP.

To bring up your wireless device (most likely wlan0):
sudo -s
ifconfig wlan0 up
#now scan for available wifi networks and note the ssid of your device
iwlist wlan0 scan
In /etc/wpa_supplicant.conf we need to put our ssid and password:
nano /etc/wpa_supplicant.conf
Example config:
network={
                     ssid="ssid"
                     psk="wifi password"
}

Ctrl + A to close and save.
To connect:
sudo wpa_supplicant -B -iwlan0 -c/etc/wpa_supplicant.conf -Dwext
Open a second tab/terminal:
sudo dhclient wlan0
Your connection should now work!

1 comment:

  1. Unlike windows operating system Ubuntu has always been incompatible with most local area networks thanks to the blog the process has been simplified.

    ReplyDelete

How to download a portion of Youtube Video with youtube-dl

First make you have both youtube-dl and ffmpeg installed: sudo apt install youtube-dl ffmpeg Then download a portion of your desired...