How can I display the list of available WiFi networks?

359,183

Solution 1

Use nmcli dev wifi command. It shows the transfer rate, the signal strength and the security as well.

enter image description here

Solution 2

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

You can find more info here: https://askubuntu.com/a/16588/362944

Solution 3

In Ubuntu 16.04 :

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

now from here you can list all available WiFi.
source from here

Solution 4

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.

Share:
359,183

Related videos on Youtube

Joshua Fox
Author by

Joshua Fox

See joshuafox.com including links to my blog, published articles, LinkedIn, GitHub, and even StackOverflow :-)

Updated on September 18, 2022

Comments

  • Joshua Fox
    Joshua Fox almost 2 years

    My Ubuntu laptops's WiFi works fine on various Wifi networks. But the list of available networks accessed from the toolbar icon of nm-applet by 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 list all available networks so I can connect to one?

    I am using Xubuntu 14.04

    • steeldriver
      steeldriver over 9 years
      Does terminal command nmcli dev wifi list give anything additional to what's shown by the GUI applet?
    • Todd Baur
      Todd Baur over 5 years
      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"?
  • Serge Stroobandt
    Serge Stroobandt about 6 years
    Here is the pertaining mnemonic: network manager command line interface device wifi
  • Jared Smith
    Jared Smith over 5 years
    Note this does not work with broadcom wireless cards.
  • Joshua Fox
    Joshua Fox over 5 years
    wlan0 should be replaced with real value from ifconfig of from /sys/class/net subfolder name, as stated in answer from @gujarat santana
  • Todd Baur
    Todd Baur over 5 years
    For me this only found the WiFi network I was connected to rather than all available.
  • Todd Baur
    Todd Baur over 5 years
    It requires sudo to display the entire list.
  • Dan Esparza
    Dan Esparza over 5 years
    @JaredSmith do the other solutions work with broadcom wifi cards?
  • Jared Smith
    Jared Smith over 5 years
    @DanEsparza they should
  • bitinerant
    bitinerant over 5 years
    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
    bitinerant over 5 years
    @icc97 - if you only see your current network, run nmcli dev wifi rescan, wait a bit, and then try nmcli dev wifi again.
  • PJ Brunet
    PJ Brunet almost 5 years
    For more details nmcli d --help
  • bassmadrigal
    bassmadrigal almost 4 years
    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
  • EkriirkE
    EkriirkE over 2 years
    This works better than nmcli for me because it breaks down and shows non-latin characters, where nmcli just shows a "?"
  • Admin
    Admin about 2 years
    @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.