160

My Ubuntu laptop's Wi-Fi works fine on various Wi-Fi networks. But the list of available networks accessed from the toolbar icon of nm-applet no longer appears. I just see the known networks. The list of hidden networks also doesn't show any new networks.

sudo iwlist scan likewise only shows known networks.

How do I get a list of all available networks so I can connect to one?

I am using Xubuntu 14.04.

2
  • 7
    Does terminal command nmcli dev wifi list give anything additional to what's shown by the GUI applet? Dec 30, 2014 at 13:38
  • 3
    Also worth noting that sudo iwlist scan shows more available networks than iwlist scan (without sudo) - so this question by itself is helpful. But perhaps it should be renamed to "How can I display the list of hidden WiFi networks"?
    – icc97
    Nov 13, 2018 at 10:00

4 Answers 4

228

Use the nmcli dev wifi command. It shows transfer rate, signal strength, and security (e.g. WPA) as well:

screenshot after running "nmcli device wifi list

For more, see nmcli's manual and this for usage examples of nmcli.

7
  • 33
    Here is the pertaining mnemonic: network manager command line interface device wifi Apr 17, 2018 at 0:59
  • 8
    For me this only found the WiFi network I was connected to rather than all available.
    – icc97
    Nov 13, 2018 at 9:53
  • 8
    It requires sudo to display the entire list.
    – icc97
    Nov 13, 2018 at 10:01
  • 3
    The BSSID (MAC of remote access point) and other details are not shown by default, but you can show them with the -f option, e.g. nmcli -f SSID,BSSID,DEVICE dev wifi. Use -f ALL to see available fields.
    – bitinerant
    Feb 21, 2019 at 8:05
  • 11
    @icc97 - if you only see your current network, run nmcli dev wifi rescan, wait a bit, and then try nmcli dev wifi again.
    – bitinerant
    Feb 21, 2019 at 8:09
79

To scan all networks try using the command sudo iw dev wlan0 scan | grep SSID.

You can find more info in the AU answer How to connect and disconnect to a network manually in terminal?

5
  • 3
    wlan0 should be replaced with real value from ifconfig of from /sys/class/net subfolder name, as stated in answer from @gujarat santana
    – Joshua Fox
    Nov 11, 2018 at 12:27
  • 1
    This works better than nmcli for me because it breaks down and shows non-latin characters, where nmcli just shows a "?"
    – EkriirkE
    Dec 30, 2021 at 5:40
  • 1
    @EkriirkE well, for a more detailed breakdown on wifi networks in nmcli command you could use -f ALL option, e.g. nmcli -f ALL dev wifi. Although I admit, it's still not as detailed as iw's information.
    – Hi-Angel
    Jul 2, 2022 at 0:01
  • @Hi-Angel Not sure the relevance? We just want SSIDs not even more technical info
    – EkriirkE
    Jul 24, 2022 at 8:45
  • @EkriirkE sorry, I probably misread your comment. You stated that it worked better for you since "it breaks down", and I thought you meant "breaking down" as in "showing detailed information". With that said, I am not sure who are "we" ☺ I definitely wanted the technical details on the networks, and the question or the answer don't seem to limit the question to just SSIDs.
    – Hi-Angel
    Jul 24, 2022 at 10:42
21

In Ubuntu 16.04:

  1. Go to /sys/class/net you can see list of directories here.
  2. Find the wireless interface. It has wireless directories, for example in my case it's wlp10. You can check it using ls wlp10. If the directory's name different, use that directory's name.
  3. sudo iwlist wlp1s0 scan | grep ESSID

From here you can list all available Wi-Fi access points.

Source here.

3
  • 1
    Note this does not work with broadcom wireless cards. Oct 21, 2018 at 13:11
  • @JaredSmith do the other solutions work with broadcom wifi cards? Jan 7, 2019 at 12:48
  • 1
    @DanEsparza they should Jan 7, 2019 at 13:01
8

Further to what has been already answered here, I've merged a few of them and added a little flavor of my own.

As for the nmcli answer, sure, do that if you want to install more software. But if you're looking for Access Points, maybe you don't have an internet connection yet and are unable to connect to install said software. With all that said, here's my solution:

for i in $(ls /sys/class/net/ | egrep -v ^lo$); do sudo iw dev $i scan | grep SSID | awk '{print substr($0, index($0,$2)) }'; done 2>/dev/null | sort -u 

Breaking it down:

for i in $(ls /sys/class/net/ | egrep -v ^lo$);

Lets have a look at all the contents of the location /sys/class/net. This will list all the network devices, but we're not really interested in the loopback interface. so we'll ignore that one

do sudo iw dev $i scan | grep SSID | awk '{print substr($0, index($0,$2)) }';done

For each of the network interfaces we found above, lets do the scan to list all the SSIDs (and only the SSIDs)

2>/dev/null 

And ignore all the errors (like searching for SSIDs with ethernet interfaces).

| sort -u

And finally, If you have multiple wi-fi adapters on the system, only list each SSID once.

1
  • I know I'm late to the party, but if you want to just check for just wireless devices (and leave lo and ethernet devices alone), you can do the following: for i in /sys/class/net/*; do [ -d "$i/wireless" ] && sudo iw dev $(basename $i) scan | grep SSID | awk '{print substr($0, index($0,$2)) }'; done | sort -u Aug 8, 2020 at 6:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .