You can support us by downloading this article as PDF from the Link below. Download the guide as PDF

Connecting to a network via Linux Terminal is as sweet as candy. Have you bumped into issues and unknown errors while trying to connect to WIFI network before?. If so, then you have to learn how to don it on command line. Some Linux flavors  and distributions will fail to connect to wifi network at some point but using Terminal to connect to WIFI network never fails.
If you’ve just installed your Linux, we have a lot of tutorials on How to for Linux.

This tutorial is universal and will work well on most Linux distros out there, both old and future releases. It also work well on both WPA/WPA2 wireless networks.
These are the tools you would require to connect to wireless network in Linux’s command line terminal.

1) Ping
2) ip
3) iw
4) wpa-supplicant

Brief summary of the tools mentioned.

It is anew 802.11 base CLI configuration utility for all wireless devices. It has support for all new drivers that have been added to the kernel recently.

It stands for Internet protocol. It is a utility in Linux used to test and show routing ,devices,policy routing and tunnels.

Supplicant is the IEEE 802.1X/WPA component uses at the client station. Its purpose is implementing key negotiation with a WPA Authentication and Controlling roaming and IEEE 802.11 authentication and association Wlan drivers.

Utility used to test whether destination host is live or dead. It uses ICMP echo messages.

STEP 1: Finding all available Wifi and adapters.
Begin by finding all available Wifi and adapters with iw command


   # iw dev
     phy #1
     Interface wlan0
     ifindex 4
     wdev 0x1
     addr 00:27:10:0e:b3:54
     type managed

Wlan0 is the device names. Phy#1 is the designated name. Type managed means it is client that connects to AP.
ifindex 4 means is as per connected port.

STEP 2: Check Device Status
To check if the wireless device is up or not, we use the following command.

# ip link show wlan0

The output show us Wlan0 as up and wlan1  as down.

STEP 3: Bring up the wifi interface
Use the following command

# sudo ip  link set wlan0 up

STEP 4: Check connection status.
Use the following command to check connection status

# iw wlan0 link

To find all WIFI networks detected, type the following command on the terminal.

# iw wlan0 scan

STEP 5: Generate WPA/WPA2 config file foe wpa-supplicant that contains pre-shared key for all wifi network

# wpa_passphrase SSID_name >> /etc/wpa_supplicant.conf

Step 6: Connect to WPA/WPA2 wifi network using wpa_supplicant

# wpa_supplicant -B -D wext -i wla0 -C /etc/wpa_supplicant.conf

-D specifies the wireless driver wext generic driver.
-C gives the actual path of config file
-B runs the wpa_supplicant on the background.

STEP 7: Get IP address fro DHCP server

# dhclient wlan0

Verify IP address with the ifconfig command.

# ifconfig -a

STEP 8:  Add default routing rule to make sure you have correct routing rules

# ip route show default via dev wlan0 dev wlan0 proto kernel scope link src

STEP  9: Test the connectivity by ping to any IP address global like google DNS servers.


Search Tags
Wifi connectivity with Terminal in Linux
How to connect to WIfi in Linux easily
Using Terminal to connect to WPA wireless network.

You can support us by downloading this article as PDF from the Link below. Download the guide as PDF


  1. This post is really informative to all kind of people. I am very happy to see the post. I will request you to give more information about this. I have gotten many knowledgably speech form here. I have also website where you can get some knowledge which may be for your welfare. Visit here…..
    wireless network


Please enter your comment!
Please enter your name here