5

I'm working with a Pi running Raspbian. Is there a way to open the network list with a command from the terminal? This is the list I mean:

Screenshot of Wi-Fi network list

I have searched in the file ~/.config/lxpanel/LXDE-pi/panels/panel is defined the menu bar (sizes, icons, applications, etc ...). I think this is the code that defines the icon:

Plugin { 
 type=dhcpcdui
  Config { } 
}
  • Are you looking to get around not having a mouse and open the list as if you had clicked it with a mouse or do you want to list the available networks via the command line? – Steve Robillard Jun 8 '17 at 7:52
  • Yes, to open it without the mouse. – Francisco Javier Gil Blanco Jun 8 '17 at 8:31
  • What will that give you that you can't from Darth Vader's answer below? Anything you can do with the applet you can do from the commandline (which does not require a mouse). – Steve Robillard Jun 8 '17 at 9:11
  • Yes, I can modify the file that has named me 'Darth Vader', but the problem is that I can not find the command that I have to execute to display the list of networks. – Francisco Javier Gil Blanco Jun 8 '17 at 9:29
  • it is the first command in Darth Vader's answer iwlist wlan0 scan. This may also help raspberrypi.org/documentation/configuration/wireless/… – Steve Robillard Jun 8 '17 at 9:31
7

I think the command you are looking for is:

iwlist wlan0 scan

Which will show a list of available Wi-Fi networks.

If you are connected to a network already you can see a list of the other devices on the network with:

nmap

To launch the terminal using a keyboard you can create a keyboard shortcut such as Ctrl+Alt+t. To do this first run:

nano ~/.config/openbox/lxde-rc.xml

This will allow you to modify the ~/.config/openbox/lxde-rc.xml file.

Anywhere between the <keyboard> and </keyboard> tags add:

<!-- Launch terminal when ctr-alt-t is pressed -->
  <keybind key="C-A-t">
    <action name="Execute"><command>lxterminal</command></action>
  </keybind>

If you put this piece of code just before the </keyboard> tag it should look something like this:

<!-- Launch gnome-screenshot when Print is pressed -->
  <keybind key="Print">
    <action name="Execute"><command>gnome-screenshot</command></action>
  </keybind>
<!-- Launch terminal when ctr-alt-t is pressed -->
  <keybind key="C-A-t">
    <action name="Execute"><command>lxterminal</command></action>
  </keybind>
</keyboard>
  • What I am looking for is to open the dialog of the list of networks by command, to be able to execute that command from a script of 'python'. And the problem is that I do not know which process I should launch. – Francisco Javier Gil Blanco Jun 8 '17 at 8:40
  • If you want to script something reliably use the command line not the gui. – Steve Robillard Jun 8 '17 at 19:42
  • 1
    Weird thing, iwlist wlan0 scan shows only the network I am connected to, not all. – Suncatcher Jun 30 '18 at 20:30
  • @Suncatcher Try running the command as root. See my answer. – Dogweather Oct 8 '18 at 23:26
3

Use iwlist as root to get a fresh scan. It gives a lot of output. Here's a way to get just a list of available networks:

$ sudo iwlist wlan0 scanning | grep ESSID
                ESSID:"Daisycat"
                ESSID:"AI Lab"
                ESSID:"E4A451"
                ESSID:"EB4E7F"
                ESSID:"Lan Solo"
                ESSID:"3FA29B"
                ESSID:"BaronTweet"
                ESSID:"E15F8D"
                ESSID:"Malik3199 2.4G"
                ESSID:""

From the manual page:

Triggering scanning is a privileged operation (root only) and normal users can only read left-over scan results.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.