Connect to WiFi Using Terminal in Arch Linux and Other Distros

2 min


This quick guide explains the steps you need to set up and connect to WiFi using terminal in Arch Linux and other distros.

This guide is ideal for those scenarios where you are stuck with a terminal without any GUI and no other wired internet connectivity is available. These steps help you to manually detect the wireless card, device and connect to the WiFi hotspot with password authentication via terminal.

This guide uses iwd (Net Wireless Daemon) to connect to WiFi via terminal.

Connect to WiFi Using Terminal in Arch Linux and Other Distros

Setup iwd

iwd package comes with three main modules.

iwctl : The wireless client
iwd: The Daemon
iwmon : Monitoring tool

On the terminal type –

iwctl
iwctl Prompt
iwctl Prompt

If you get a command not found, then you need to download the package from here. So get help from any other system connected to the internet to download the package and install via mounting the USB.

Alternatively, if you have a USB dongle then plugin and install via the below commands. The USB dongle should work out of the box in Arch and most Linux systems today to connect to the internet.

Arch

pacman -S iwd

Debian, Ubuntu, and other similar distributions

sudo apt-get install iwd

Fedora

sudo dnf install iwd

If you get an iwctl prompt (like below), then proceed to the next step.

Configure

Run the below command to get your system’s wireless device name.

device list
iwctl - device list
iwctl – device list

To get the list of WiFi networks, run the below command. Replace wlan0 with your device name on the below command and all the following commands.

station wlan0 get-networks
iwctl - available networks
iwctl – available networks

The command gives you the list of available WiFi network with security type and signal strength.

SEE ALSO:   How to Install Enlightenment Desktop in Arch Linux [Complete Guide]

Connect

To connect to the WiFi network, run the below command with the WiFi access point name from the above “get-networks” command.

station wlan0 connect

Enter your WiFi password when prompted.

connect to WiFi using iwctl
connect to WiFi using iwctl

If all goes well you should be connected to the internet.

You can check the connection using a simple ping command as follows. The ping replies successful packet transfers for a stable connection.

ping -c 3 google.com

You can also check the status of the connection using the below command.

station wlan0 show

The iwd keeps the configuration file at /var/lib/iwd as a .psk file with your access point name.

This file contains a hash file that is generated using the password and SSID of your WiFi network.

Press CTRL+D to leave from the iwctl prompt.

I hope this guide helps you to connect to the internet via terminal. This helps when you have no other way to connect to WiFi. For example, if you are installing Arch Linux in a stand-alone system (not a VM) you need to connect to the internet for downloading packages via terminal using pacman.

If you face any trouble, mention the error messages in the comment box below.


We bring the latest tech, software news and stuff that matters. Stay in touch via Telegram, Twitter, YouTube, and Facebook and never miss an update!

Join our Telegram channel and stay informed on the move.

Also Read


Like it? Share with your friends!

Arindam

Creator of debugpoint.com. All time Linux user and open-source supporter. Connect with me via Telegram, Twitter, or send us an email.
Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

3 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments
3
0
Would love your thoughts, please comment.x
()
x