iw

Modern command-line tool for configuring and inspecting wireless (802.11) devices using the Linux nl80211 interface.

Category: Networking Wi‑Fi nl80211 Wireless Diagnostics iproute2-style

What it does

iw configures and queries wireless interfaces. It replaces older tools like iwconfig and provides detailed control over Wi‑Fi devices, including scanning, regulatory settings, power management, and station information.

How it works (mechanical)

Wireless drivers expose functionality via the kernel’s nl80211 subsystem. iw communicates with the kernel over netlink to retrieve or modify wireless configuration.

  • Queries PHY and interface capabilities
  • Performs active/passive Wi‑Fi scans
  • Displays station (client) statistics
  • Controls regulatory domain and transmit power

10 Practical Examples

# 1) Show wireless interfaces
iw dev
# 2) Show physical device (PHY) capabilities
iw phy
# 3) Scan for available networks
sudo iw dev wlan0 scan
# 4) Scan and filter SSIDs
sudo iw dev wlan0 scan | grep SSID
# 5) Show current link status
iw dev wlan0 link
# 6) Show station statistics (signal, tx/rx rates)
iw dev wlan0 station dump
# 7) Set regulatory domain (country code)
sudo iw reg set US
# 8) Show current regulatory domain
iw reg get
# 9) Set transmit power (example: 20 dBm)
sudo iw dev wlan0 set txpower fixed 2000
# 10) Put interface into monitor mode (advanced)
sudo ip link set wlan0 down
sudo iw dev wlan0 set type monitor
sudo ip link set wlan0 up

Notes & Gotchas

  • Most operations require root privileges.
  • NetworkManager may override manual settings.
  • Scanning can briefly disrupt connectivity.
  • Monitor mode support depends on hardware/driver.
  • Use correct regulatory domain to comply with local laws.

Historical Context

iw replaced the older Wireless Extensions tools (iwconfig, iwlist) as Linux adopted the nl80211 interface. It provides a more complete and modern framework for wireless management.

Modern Equivalent / Related Tools

  • nmcli — manage wireless connections via NetworkManager
  • iwconfig — legacy wireless tool (deprecated)
  • ip link — bring interfaces up/down
  • wpa_supplicant — authentication backend
  • tcpdump / airodump-ng — monitor-mode analysis