LinuxCommandLibrary

iw

Configure wireless network interfaces

TLDR

Scan for available wireless networks

$ iw dev [wlp] scan
copy

Join an open wireless network
$ iw dev [wlp] connect [SSID]
copy

Close the current connection
$ iw dev [wlp] disconnect
copy

Show information about the current connection
$ iw dev [wlp] link
copy

List all physical and logical wireless network interfaces
$ iw dev
copy

List all wireless capabilities for all physical hardware interfaces
$ iw phy
copy

List the kernel's current wireless regulatory domain information
$ iw reg get
copy

Display help
$ iw help
copy

SYNOPSIS

iw [--debug] [--clock=<resolution>] [--help] [--version] object command [interface] [args...]
where object is dev, phy, reg, station, mesh, mpath, nan

PARAMETERS

--debug
    Enable extra debug output during operation

--clock=<resolution>
    Set clock resolution in microseconds (e.g., 1)

--help
    Display help message and exit

--version
    Print version information and driver details

DESCRIPTION

iw is a powerful command-line utility for managing and configuring wireless LAN devices on Linux using the modern nl80211 and cfg80211 kernel interfaces. It supersedes the deprecated iwconfig from the Wireless Extensions API, offering support for all contemporary wireless features like mesh networking, P2P, nan, monitor mode, and advanced scanning. iw interacts directly with the kernel via netlink sockets, providing detailed information on physical devices (phy), virtual interfaces (dev), regulatory domains (reg), and stations. Common tasks include scanning for networks, displaying link status, connecting to access points, setting channels, managing power save, and dumping frames in monitor mode. It requires drivers compatible with cfg80211 and typically root privileges. Unlike older tools, iw is actively maintained and handles complex scenarios like multi-vendor hardware seamlessly. Usage revolves around subcommands like iw dev <interface> scan or iw phy phy0 info, making it indispensable for network administrators, Wi-Fi troubleshooting, and scripting wireless automation.

CAVEATS

Requires root privileges for most commands; only supports nl80211/cfg80211 drivers (not Wireless Extensions); some options need specific kernel/driver support; monitor mode may interfere with normal operation.

KEY SUBCOMMANDS

dev: manage interfaces (scan, link, connect)
phy: physical device info (info, set, channels)
reg: regulatory domain (set, get)
station: dump/add/del stations

EXAMPLE USAGE

iw dev wlan0 scan - list nearby networks
iw dev wlan0 connect MySSID key 0:password - associate with WPA
iw phy phy0 info - show hardware capabilities

HISTORY

Developed starting in 2008 by Jiri Benc and mac80211 contributors as part of Linux wireless subsystem evolution. Introduced with kernel 2.6.32+ to leverage nl80211, replacing obsolete wireless-tools. Actively maintained in the iw git repo, with major updates for features like 802.11ax, Wi-Fi 6, and mesh protocols.

SEE ALSO

iwconfig(8), iwspy(8), iwpriv(8), wpa_supplicant(8), hostapd(8), rfkill(8), ip(8)

Copied to clipboard