How to Use iwctl to Manage Wi-Fi on Linux

Tirsasaki
Tirsasaki
16 Februari 2025

If you are using a Linux distribution that relies on iwd (iNet wireless daemon) for managing Wi-Fi connections, you will need to use the iwctl command-line tool. This guide will walk you through using iwctl to connect to Wi-Fi, list available networks, and manage your wireless connections efficiently.

Prerequisites

Before proceeding, ensure that:

  • You have iwd installed on your system.
  • Your Wi-Fi adapter is recognized and enabled.
  • You have root or sudo privileges.

Checking if iwd is Installed

To verify if iwd is installed, run:

systemctl status iwd

If it is not installed, you can install it using your package manager:

Fedora:

sudo dnf install iwd

Arch Linux:

sudo pacman -S iwd

Debian/Ubuntu:

sudo apt install iwd

Enable and start the iwd service:

sudo systemctl enable --now iwd

Launching iwctl

To open the iwctl interactive shell, run:

iwctl

You will enter an interactive mode where you can execute commands.

Listing Available Wi-Fi Devices

To check your available wireless interfaces, use:

device list

This will display your Wi-Fi adapter name, which you will need for further commands.

Scanning for Available Networks

To scan for nearby Wi-Fi networks, run:

station <device> scan

Replace <device> with the name of your Wi-Fi adapter (e.g., wlan0).

To view the scan results, use:

station <device> get-networks

Connecting to a Wi-Fi Network

To connect to a Wi-Fi network, use the following command:

station <device> connect <SSID>

If the network requires a password, you will be prompted to enter it.

Verifying Connection

To confirm that you are connected, run:

station <device> show

It should display the connection status and assigned IP address.

Disconnecting from a Network

To disconnect from a Wi-Fi network, use:

station <device> disconnect

Exiting iwctl

To exit the iwctl interactive shell, type:

exit

Conclusion

The iwctl command-line tool provides a straightforward way to manage Wi-Fi connections on Linux using iwd. By following the steps in this guide, you can connect to and manage wireless networks efficiently. If you encounter issues, check your Wi-Fi adapter status and ensure iwd is running properly.

For more Linux tutorials and troubleshooting tips, stay tuned to our website!