This guide shows you how to discover nearby Wi-Fi networks from the command line on Ubuntu Server. You’ll learn the essential commands to list available access points, check signal strength, and identify security types—useful when setting up a headless server or troubleshooting wireless connectivity.
What You’ll Need
- A machine running Ubuntu Server (20.04 or newer) with a wireless network interface.
- Root or sudo access to install packages and run scanning commands.
- An active internet connection (optional, but needed to install missing tools).
- Physical or remote access to the terminal (SSH works fine).
Step-by-Step
- Identify your wireless interface. Run
ip link showoriw devto list network interfaces. Look for a name likewlan0orwlx.... If you don’t see one, your Wi-Fi adapter may not be recognized (see Troubleshooting). - Check if the interface is up. Use
ip link set wlan0 up(replacewlan0with your interface name). You may needsudo. If it’s already up, you’ll seestate UPin the output. - Install the necessary tools. Most Ubuntu Server installs include
iwandwpa_supplicant, but if not, install them with:sudo apt update && sudo apt install iw wireless-tools. This provides theiwandiwlistcommands. - Scan using
iw(recommended). Runsudo iw dev wlan0 scan | grep -E "SSID|signal|freq". This shows the network name (SSID), signal strength in dBm, and frequency. If you want the full details, omit thegrepand just runsudo iw dev wlan0 scan. - Scan using
iwlist(alternative). If you prefer a more traditional output, runsudo iwlist wlan0 scan. This lists all networks with ESSID, channel, quality, and encryption info. To get a clean list of SSIDs, use:sudo iwlist wlan0 scan | grep ESSID. - Interpret the results. The scan output shows each network’s SSID, BSSID (MAC address), signal level (e.g., -60 dBm), channel, and security (e.g., WPA2). A signal closer to 0 dBm is stronger; -70 dBm or lower is weak.
- Scan without sudo (optional). Some systems allow scanning as a regular user if the interface is set to allow it. Try
iw dev wlan0 scanwithout sudo. If you get a permission error, stick with sudo. - Use a one-liner for a quick overview. To see just SSID and signal strength, run:
sudo iw dev wlan0 scan | awk -F': ' '/SSID/{ssid=$2} /signal/{print $2" dBm - "ssid}'. This gives a compact list.
Common Mistakes
- Forgetting sudo. Wireless scanning typically requires root privileges. Running
iw dev wlan0 scanwithout sudo often fails with “Operation not permitted.” - Using the wrong interface name. On some systems, the Wi-Fi interface is named
wlx001122334455(based on MAC) rather thanwlan0. Always check withip linkfirst. - Interface is down. If the interface is administratively down, the scan will return nothing. Bring it up with
ip link set wlan0 upfirst. - Not installing tools. Minimal Ubuntu Server installs may lack
iworiwlist. If you get “command not found”, install them as shown in Step 3. - Confusing dBm with percentage. Signal strength is shown in dBm (negative values). A value like -50 dBm is better than -80 dBm. Don’t mistake it for a percentage.
Tips
- Use
watchfor continuous scanning. To monitor networks over time, runsudo watch -n 2 'iw dev wlan0 scan | grep SSID'. This refreshes every 2 seconds. - Filter for 5 GHz networks. Add
grep -E "freq: 5"to see only 5 GHz networks, which often have less interference. - Check supported frequencies. Run
iw phy phy0 info | grep -A 10 "Band 2"to see which channels your adapter supports. - Save scan results to a file. Redirect output with
sudo iw dev wlan0 scan > scan.txtfor later analysis. - Use
nmcliif NetworkManager is installed. On desktop-oriented Ubuntu Server setups,nmcli dev wifi listgives a clean table. If it’s not installed, you can install it withsudo apt install network-manager.
Troubleshooting
- No wireless interface found. If
ip linkshows no wlan interface, your Wi-Fi adapter may be unsupported or disabled. Check withlspci | grep -i networkorlsusbto see if the hardware is detected. If it is, you may need to install proprietary drivers (e.g., for some Realtek or Broadcom chips). - Scan returns “No scan results” or empty. This can happen if the interface is down, the driver doesn’t support scanning, or you’re in an area with no networks. Bring the interface up, move closer to a router, or try
sudo iwlist wlan0 scan. - “Operation not permitted” error. This usually means you need sudo. If sudo doesn’t help, the interface may be in a bad state. Try
sudo ip link set wlan0 downthenupagain. - Command not found. Install the missing package:
sudo apt install iworwireless-tools. If you’re offline, you may need to download the .deb files on another machine and transfer them. - Scan works but no SSIDs appear. Some networks hide their SSID. You’ll see a blank SSID or “
” in the output. You can still connect if you know the name. - Signal is weak even close to router. Check if the antenna is connected (if external). Also, some USB adapters are low-power; consider using a powered USB hub.
Frequently Asked Questions
Do I need to be root to scan Wi-Fi?
Yes, on most systems scanning requires root privileges. Use sudo with the scan commands. Some distributions allow unprivileged scans if the interface is set to allow it, but that’s not the default on Ubuntu Server.
Why does my scan show no networks even though my phone sees them?
Your Wi-Fi adapter might not support the band (e.g., only 2.4 GHz while the router broadcasts 5 GHz), or the driver may not support scanning. Also, ensure the interface is up. Try sudo iwlist wlan0 scan and check for errors.
What is the difference between iw and iwlist?
iw is the modern replacement for iwconfig and iwlist. It uses the nl80211 interface and provides more detailed information. iwlist is older but still works on many systems. Both are fine for scanning.
Can I scan for Wi-Fi without installing anything?
If your system has NetworkManager installed, you can use nmcli dev wifi list without any extra packages. Otherwise, you need iw or wireless-tools, which you can install with apt.
How do I connect to a Wi-Fi network from the command line?
After scanning, you can connect using nmcli (if NetworkManager is present) or by configuring wpa_supplicant. For example: nmcli dev wifi connect "SSID" password "pass". For wpa_supplicant, you’d create a config file and run it.
What does the signal strength number mean?
It’s in dBm, a logarithmic measure. Values closer to 0 are stronger. Typically, -50 dBm is excellent, -67 dBm is good, -70 dBm is marginal, and -80 dBm is very weak. Anything below -80 dBm may be unusable.
Related
General steps for current mainstream versions; menus can differ by device and version. See the disclaimer or report an error.
More in this bed
- How to Factory Reset iPad If You Forgot Password
- Ubuntu in Windows Store: Which Editions Work?
- Secure Guest Account on Windows 11: Step-by-Step
- Stop Outlook From Changing Hyperlink Font
- Hiberfil.sys: What It Is & How to Delete It
- How to Make a Mask on Snapchat: Step-by-Step