The iw (short for “wireless”) command is a command-line tool for displaying and manipulating wireless devices on Linux systems. It provides a set of subcommands for performing various tasks related to wireless network management, such as scanning for available wireless networks, connecting to a wireless network, and getting the status of the current wireless connection.
Some common iw commands include:
- iw dev: This command displays a list of available wireless devices on the system.
- iw scan: This command scans for available wireless networks and displays information about them, such as their SSID, signal strength, and encryption type.
- iw connect: This command connects to a specific wireless network.
- iw link: This command displays the status of the current wireless connection, including the connected network’s SSID, signal strength, and encryption type.
- iw config: This command allows the user to configure wireless devices, such as setting the device’s channel, bitrate, or transmit power.
Iw can also be used to configure advanced wireless settings like creating a wireless mesh network, setting up a hotspot, or setting up a wireless card in monitor mode. The iw tool is designed to be simple and easy to use, and it is available on most Linux distributions. It can be used as an alternative or complement to other wireless management tools like iwctl, wpa_supplicant, and NetworkManager.
If you encounter the below error while running the command iw:
iw: command not found
you may try installing the below package as per your choice of distribution:
Distribution | Command |
Debian | apt-get install iw |
Ubuntu | apt-get install iw |
Alpine | apk add iw |
Arch Linux | pacman -S iw |
Kali Linux | apt-get install iw |
CentOS | yum install iw |
Fedora | dnf install iw |
Raspbian | apt-get install iw |
iw Command Examples
1. Scan for available wireless networks:
# iw dev wlp scan
2. Join an open wireless network:
# iw dev wlp connect SSID
3. Close the current connection:
# iw dev wlp disconnect
4. Show information about the current connection:
# iw dev wlp link