Wi-Fi from the command line
ipconfig and ifconfig show the IP side of a Wi-Fi adapter but nothing about the radio. For the SSID, signal, band, channel and negotiated speed, each platform has a separate tool, and one of them will also show you the saved password you have forgotten.
Quick reference
| Task | Windows | macOS | Linux |
|---|---|---|---|
| Current network, signal, channel, speed | netsh wlan show interfaces | sudo wdutil info | iw dev wlan0 link or nmcli -f ALL dev wifi |
| Scan for networks | netsh wlan show networks mode=bssid | system_profiler SPAirPortDataType (shows nearby networks) | nmcli dev wifi list --rescan yes or sudo iw dev wlan0 scan |
| Saved networks | netsh wlan show profiles | networksetup -listpreferredwirelessnetworks en0 | nmcli con show (type wifi) |
| Show a saved password | netsh wlan show profile name="X" key=clear | security find-generic-password -wa "X" | sudo nmcli -s con show "X" | grep psk |
| Connect | netsh wlan connect name="X" | networksetup -setairportnetwork en0 "X" "password" | nmcli dev wifi connect "X" password "pw" |
| Disconnect | netsh wlan disconnect | sudo ifconfig en0 disassociate (older) or toggle power | nmcli dev disconnect wlan0 |
| Radio off / on | netsh interface set interface "Wi-Fi" admin=disable/enable | networksetup -setairportpower en0 off/on | nmcli radio wifi off/on, rfkill block/unblock wifi |
| Forget a network | netsh wlan delete profile name="X" | networksetup -removepreferredwirelessnetwork en0 "X" | nmcli con delete "X" |
| Driver and capabilities | netsh wlan show drivers | system_profiler SPAirPortDataType | iw list, lspci -k | grep -A3 -i network |
| Wi-Fi event report | netsh wlan show wlanreport | sudo wdutil diagnose | journalctl -u NetworkManager -u wpa_supplicant |
Windows: netsh wlan
netsh wlan show interfaces
netsh wlan show networks mode=bssid # every access point in range with channel and signal
netsh wlan show profiles
netsh wlan show profile name="HomeWiFi" key=clear
netsh wlan show profile name="HomeWiFi" key=clear | findstr "Key Content"
netsh wlan export profile name="HomeWiFi" key=clear folder=%USERPROFILE%\Desktop
netsh wlan add profile filename="Wi-Fi-HomeWiFi.xml"
netsh wlan connect name="HomeWiFi"
netsh wlan connect name="HomeWiFi" ssid="HomeWiFi" interface="Wi-Fi"
netsh wlan disconnect
netsh wlan delete profile name="OldCafe"
netsh wlan set profileparameter name="HomeWiFi" connectionmode=auto
netsh wlan set profileorder name="HomeWiFi" interface="Wi-Fi" priority=1
netsh wlan show drivers # supports 802.11ax? hosted network? bands?
netsh wlan show wlanreport # writes an HTML report to C:\ProgramData\Microsoft\Windows\WlanReport
netsh wlan show settings
netsh wlan show blockednetworks
netsh wlan add filter permission=block ssid="Neighbour" networktype=infrastructure # hide a networkC:\>netsh wlan show interfaces
There is 1 interface on the system:
Name : Wi-Fi
Description : Intel(R) Wi-Fi 6E AX211 160MHz
GUID : 3f2a1b0c-8d4e-4f6a-9b1c-2d3e4f5a6b7c
Physical address : 84:5c:f3:1a:2b:3c
Interface type : Primary
State : connected
SSID : HomeWiFi
BSSID : d4:6e:0e:11:22:34
Network type : Infrastructure
Radio type : 802.11ax
Authentication : WPA3-Personal
Cipher : CCMP
Connection mode : Auto Connect
Band : 5 GHz
Channel : 44
Receive rate (Mbps) : 1201
Transmit rate (Mbps) : 1201
Signal : 91%
Profile : HomeWiFi
Hosted network status : Not available- BSSID
- The MAC address of the access point you are associated with. On a mesh or multi-AP network this tells you which node you are on, which is the first thing to check when one room is slow.
- Radio type
- 802.11ax is Wi-Fi 6, 802.11ac Wi-Fi 5, 802.11n Wi-Fi 4, 802.11be Wi-Fi 7. If it says 802.11n on a modern router, you may be on 2.4 GHz.
- Band / Channel
- 2.4 GHz channels 1 to 13; 5 GHz channels 36 to 165; 6 GHz channels 1 to 233. 5 GHz is faster and less congested but shorter range; DFS channels (52 to 144) can drop for a minute when radar is detected.
- Receive/Transmit rate
- The negotiated link speed, not throughput. Real throughput is roughly half. Rates below 100 Mbps on a Wi-Fi 5/6 link indicate weak signal or interference.
- Signal
- Windows shows a percentage. Roughly: 100% ≈ −50 dBm or better, 75% ≈ −62 dBm, 50% ≈ −75 dBm, 25% ≈ −87 dBm. Below about 40% expect drops.
PowerShell has no Wi-Fi cmdlets of its own; wrap netsh. To dump every saved password: (netsh wlan show profiles) | Select-String "All User Profile\s*:\s*(.+)" | ForEach-Object { $n=$_.Matches.Groups[1].Value.Trim(); $k=(netsh wlan show profile name="$n" key=clear | Select-String "Key Content\s*:\s*(.+)").Matches.Groups[1].Value; [pscustomobject]@{SSID=$n; Password=$k} }.
The Hosted network feature (netsh wlan set hostednetwork) is unsupported by most modern drivers; use Settings › Network & internet › Mobile hotspot instead.
macOS
Apple removed the long-standing airport tool in macOS 14.4 and now redacts some details unless you are root. The current set:
sudo wdutil info # SSID, BSSID, RSSI, noise, channel, PHY mode, security, tx rate, IP details
sudo wdutil info | grep -E 'SSID|RSSI|Channel|Tx Rate|Security'
sudo wdutil diagnose # full diagnostics bundle in /private/tmp
system_profiler SPAirPortDataType # card details, current network, and other local networks with channel and signal
networksetup -getairportnetwork en0 # SSID only (may say 'not associated' on 14+ for privacy)
ipconfig getsummary en0 | grep -E 'SSID|BSSID'
networksetup -listpreferredwirelessnetworks en0
networksetup -setairportnetwork en0 "HomeWiFi" "password"
networksetup -setairportpower en0 off && sleep 2 && networksetup -setairportpower en0 on
sudo networksetup -removepreferredwirelessnetwork en0 "OldCafe"
security find-generic-password -wa "HomeWiFi" # saved password from the keychain (prompts for your login)
sudo ifconfig en0 disassociate # older versions$ sudo wdutil info
————————————————————————————————————————
WIFI
————————————————————————————————————————
MAC Address : f0:18:98:3a:2b:1c (hw=f0:18:98:3a:2b:1c)
Interface Name : en0
Power : On [On]
Op Mode : STA
SSID : HomeWiFi
BSSID : d4:6e:0e:11:22:34
RSSI : -54 dBm
Noise : -92 dBm
Tx Rate : 866.0 Mbps
Security : WPA3 Personal
PHY Mode : 11ax
MCS Index : 9
Guard Interval : 800
NSS : 2
Channel : 5g44/80
Country Code : GBRSSI in dBm: −30 to −50 excellent, −50 to −67 good, −67 to −75 fair, below −75 poor. Signal-to-noise (RSSI minus noise) above 25 dB is comfortable. Holding Option while clicking the Wi-Fi menu-bar icon shows the same figures graphically, and offers Open Wireless Diagnostics, whose Window › Scan lists nearby networks with recommended channels.
Linux
NetworkManager (nmcli)
nmcli dev wifi list # scan results: SSID, band, channel, rate, signal, security
nmcli dev wifi list --rescan yes
nmcli -f IN-USE,SSID,BSSID,CHAN,RATE,SIGNAL,SECURITY dev wifi
nmcli dev wifi connect "HomeWiFi" password "secret"
nmcli dev wifi connect "HomeWiFi" password "secret" hidden yes
nmcli dev wifi connect "HomeWiFi" bssid d4:6e:0e:11:22:34 # pin to one AP
nmcli con show --active
nmcli -s con show "HomeWiFi" | grep -E 'psk|ssid' # saved password
nmcli dev disconnect wlp2s0
nmcli con delete "OldCafe"
nmcli radio wifi off; nmcli radio wifi on
nmcli dev wifi hotspot ifname wlp2s0 ssid MyHotspot password "12345678"
nmcli con mod "HomeWiFi" wifi.band a # prefer 5 GHz (a) or 2.4 GHz (bg)
nmcli con mod "HomeWiFi" wifi.cloned-mac-address random
nmcli con mod "HomeWiFi" connection.autoconnect-priority 10
sudo cat /etc/NetworkManager/system-connections/HomeWiFi.nmconnection # the profile file, including psk$ nmcli dev wifi list
IN-USE BSSID SSID MODE CHAN RATE SIGNAL BARS SECURITY
* D4:6E:0E:11:22:34 HomeWiFi Infra 44 540 Mbit/s 89 ▂▄▆█ WPA2 WPA3
D4:6E:0E:11:22:33 HomeWiFi Infra 6 130 Mbit/s 72 ▂▄▆_ WPA2 WPA3
3C:22:FB:AA:BB:CC Neighbour Infra 1 195 Mbit/s 34 ▂▄__ WPA2iw (any Linux)
iw dev # wireless interfaces and their type
iw dev wlp2s0 link # SSID, BSSID, signal dBm, rx/tx bitrate
iw dev wlp2s0 info # channel, txpower, mode
sudo iw dev wlp2s0 scan | grep -E 'SSID|signal|freq|primary channel'
sudo iw dev wlp2s0 scan | grep -B5 -A20 'SSID: HomeWiFi'
iw dev wlp2s0 station dump # per-AP stats: signal, retries, failed, bitrates
iw list # hardware capabilities: bands, channels, HT/VHT/HE, AP mode support
iw reg get
sudo iw reg set GB
watch -n1 'iw dev wlp2s0 link | grep -E "signal|bitrate"' # live signal while walking around
cat /proc/net/wireless # link quality and level per interface
rfkill list # soft/hard blocked?
sudo rfkill unblock all$ iw dev wlp2s0 link
Connected to d4:6e:0e:11:22:34 (on wlp2s0)
SSID: HomeWiFi
freq: 5220
RX: 4213947 bytes (31292 packets)
TX: 1183094 bytes (9021 packets)
signal: -54 dBm
rx bitrate: 866.7 MBit/s VHT-MCS 9 80MHz short GI VHT-NSS 2
tx bitrate: 780.0 MBit/s VHT-MCS 8 80MHz short GI VHT-NSS 2
bss flags: short-slot-time
dtim period: 1
beacon int: 100Frequency to channel: 5220 MHz is channel 44 (5 GHz channels are (freq − 5000) / 5); 2437 MHz is channel 6 (2.4 GHz channels are (freq − 2407) / 5).
iwd (iwctl), wpa_supplicant, legacy iwconfig
# iwd (Arch, some Ubuntu setups)
iwctl station wlan0 scan
iwctl station wlan0 get-networks
iwctl station wlan0 connect HomeWiFi
iwctl station wlan0 show
# wpa_supplicant directly (no manager)
wpa_passphrase HomeWiFi secret | sudo tee /etc/wpa_supplicant/wpa_supplicant-wlan0.conf
sudo wpa_supplicant -B -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant-wlan0.conf
sudo wpa_cli status
sudo wpa_cli scan && sudo wpa_cli scan_results
sudo dhclient wlan0
# wireless-tools (deprecated, may not be installed)
iwconfig
iwgetid -r # just the SSID
iwlist wlan0 scan | grep ESSIDDiagnosing a bad Wi-Fi link
- Signal. Below −70 dBm (about 40% on Windows) the link will be unreliable. Move closer, move the router higher and into the open, or add an access point. Signal is not the same as speed: a strong 2.4 GHz link can still be slow.
- Band. Check whether you are on 2.4 or 5/6 GHz. If a dual-band network uses one SSID, the device chooses, and it often chooses badly. Splitting the bands into two SSIDs, or setting
wifi.band a/ a "prefer 5 GHz" driver option (Windows Device Manager › Wi-Fi adapter › Advanced › Preferred Band), forces it. - Channel congestion. Scan and count networks on your channel. On 2.4 GHz only channels 1, 6 and 11 do not overlap. On 5 GHz pick a channel nobody else uses; let the router choose automatically if it does that well.
- Retries and failures.
iw dev wlan0 station dumpshows tx retries and tx failed; rising counts with good signal mean interference (microwave ovens, baby monitors, USB 3 devices near a 2.4 GHz antenna, a neighbour's AP). - Roaming. On mesh systems, note the BSSID. If it stays on a far node while you stand next to a near one, the client is "sticky"; toggling Wi-Fi forces a re-selection, and some routers offer 802.11k/v/r to steer clients.
- Driver and power saving. Windows: Device Manager › adapter › Power Management › untick Allow the computer to turn off this device; Advanced › MIMO Power Save Mode = No SMPS. Linux:
iw dev wlan0 get power_save,sudo iw dev wlan0 set power_save off; NetworkManager:nmcli con mod "X" wifi.powersave 2. Update the driver or firmware (dmesg | grep -i firmware). - Prove it is Wi-Fi. Plug in a cable. If the problem disappears, it is the radio link; if not, it is the router or upstream, and no amount of Wi-Fi tuning will help.