Hacker News new | past | comments | ask | show | jobs | submit login
How to Show Available WiFi Networks on Linux from the Command Line (linuxuprising.com)
80 points by logix on Dec 8, 2019 | hide | past | favorite | 27 comments



Oddly nobody here mentions horst. Quit a nice CLI package for exactly this (and a little more).

From their github:

horst is a small, lightweight IEEE802.11 WLAN analyzer with a text interface. Its basic function is similar to tcpdump, Wireshark or Kismet, but it's much smaller and shows different, aggregated information which is not easily available from other tools. It is made for debugging wireless LANs with a focus on getting a quick overview instead of deep packet inspection and has special features for Ad-hoc (IBSS) mode and mesh networks. It can be useful to get a quick overview of what's going on all wireless LAN channels and to identify problems.

https://github.com/br101/horst


If you switch to iwd from wpa_supplicant there is also iwctl.


I strongly recommend iwd over wpa_supplicant. It is simple, intuitive, and just works. I have been using it on my laptop for over a year with no issues.


I use and recommend this. iwd actually makes wireless easy.


Is iwlist not the thing anymore?


It is. Personally, I find the format far too verbose for casual use and have to process the output to make it concise enough:

  iwlist wlan0 scan | awk -F: '
  BEGIN {
    printf "%-40s | %3s | %5s | %4s\n", "SSID", "Enc", "Qual", "Chan"
  }
  function print_network() {
    printf "%-40s | %3s | %5s | %4s\n", essid, key, quality, channel
  }
  /^[[:space:]]*Cell [0-9]+/ { if (key) { print_network() } }
  /^[[:space:]]*Channel:/ { channel=$2 }
  /^[[:space:]]*Encryption key:/ { key=$2 }
  /^[[:space:]]*ESSID:/ { essid=$2 }
  /^[[:space:]]*Quality=/ {
    match($0, /[0-9]+\/[0-9]+/)
    quality=substr($0, RSTART, RLENGTH)
  }
  END { print_network() }'


both iw and iwlist are still a thing. There is probably some convoluted proc path that gives a listing as well.


procfs is unlikely. Scanning is not something that the kernel does by itself, a userspace application (usually wpa_supplicant) needs to perform it actively. You can see this by running e.g.

  sudo iw dev $IFACE scan
on a system running wpa_supplicant (e.g. through NetworkManager). Every so often you'll get a "Device busy" error because wpa_supplicant is scanning already.


I tend to use wicd[1] they have gtk/curses/cli versions , I've had problems with nm before.

(1) https://launchpad.net/wicd


I loved wicd, and had had problems with nm.

Then I had a problem with wicd - interface issues caused by the deprecation of ifconfig in favor of "ip" tools (Debian). Wicd is a set of Python scripts that call ifconfig.

So I submitted a patch to fix my issue, and tied it to the multiple bug requests already reporting the issue...

Wicd hasn't been updated in years though. With ifconfig starting to break (at least in some situations) it's going to need some updates soon.

I switched back to nm and found it's working extremely well these days.


I usually go with nmtui. You can also connect using it.


What works best for me (as a sway user): attaching a keyboard shortcut that opens / closes a floating window of nmtui.


I prefer the simplicity of https://github.com/firecat53/networkmanager-dmenu, which works fine under sway


If I remember correctly, that one didn't mask my password with rofi.


One of the nice things about OpenSUSE is that you can use Yast from the gui or the console and it works identically. It's very nice. You can hand off configuration to Network Manager, or just configure everything in Yast's Network module.


Pleasantly surprised that this is actually very simple, was psyching myself up for some horror of pipes and /dev.

The output from nmcli is quite pretty to boot!


I find nmtui imminently usable, for scanning and connecting, especially in Sway where nmapplet doesn't work.


I agree and that's what I use most of the time, but sometimes nothing beats the simplicity of doing

    nmcli c my-wifi up
When you know you want to connect to a Wi-Fi network you know is in range. Also, nmtui doesn't support "enterprise" Wi-Fi (PEAP, for eduroan, for instance).


I use `wifi-menu` to connect to new networks. It creates the profile for me (generally just works) and everything. Otherwise, `wavemon` for general scanning.


what is the best way under Raspian Buster without installing anything?


`iwlist wlan0 scan` works


Thanks!


It's kind of funny that it's espousing GNOME tools for command line work. ;-)


NetworkManager does not depend on GNOME. It's part of the freedesktop.org stack and used in server distros likewise.


My bad. I forgot it was freedesktop.org, not GNOME. Sure it's used in many server distros, but it's really a desktop tool.


To me, scanning wireless networks is primarily a desktop task, and some desktop software is CLI or TUI and doesn't need a GUI.


Would you consider an access point or embedded device a desktop?




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: