How to force Network Manager to rescan connections?

20

6

How to force Network Manager in Ubuntu to rescan wireless connections?

After closing my laptop, network manager does not see new wireless connections. Is there any bash command to force rescan? sudo service network-manager restart does not help.

takeshin

Posted 2010-07-15T15:53:28.700

Reputation: 1 385

Answers

26

sudo iwlist interface scan

Where interface is the name of your wireless card, e. g. wlan0

rumtscho

Posted 2010-07-15T15:53:28.700

Reputation: 3 586

use sudo ifconfig to find out the name of the "interface" – Bhikkhu Subhuti – 2016-08-26T10:58:29.860

Do you really need to use sudo for this? – Morten – 2017-07-12T08:04:37.023

@Morten: Yes, we do need sudo. "Triggering scanning is a privileged operation (root only) and normal users can only read left-over scan results." (man iwlist) – Falko – 2018-08-08T09:26:17.080

15

Try

nmcli device wifi rescan

and

nmcli device wifi list

to see available networks

Davide

Posted 2010-07-15T15:53:28.700

Reputation: 151

1Best answer. Without using sudo. – Khurshid Alam – 2017-07-05T06:17:26.013

1This should be the accetpted answer. It is, after all, the "command-line tool for controlling NetworkManager". It gives a nice graphical command-line output if you specify list (or no argument at all). – Mike S – 2017-10-31T12:06:53.840

2

In Ubuntu 16.04 and newer, restarting NetworkManager with sytemctl works (at least after scanning the networks manually with iwlist):

# Find the name of the network interface, e.g. wlan0 or wlp3s0
ip addr show      

# Scan for WLAN networks (replace wlan0 by the correct interface)
sudo iwlist wlan0 scan

# Restart Ubuntu’s Network Manager so it reloads the Access Point list
sudo systemctl restart NetworkManager

Simon A. Eugster

Posted 2010-07-15T15:53:28.700

Reputation: 840

1

sudo /etc/init.d/networking restart should work...

laurent

Posted 2010-07-15T15:53:28.700

Reputation: 4 166

1

Simply deactivating and reactivating your wireless module would be a workaround.

Bobby

Posted 2010-07-15T15:53:28.700

Reputation: 8 534

-1. Though this naively seems like a decent solution, it eventually led me to hard-block my network card for the weekend. – Abhishek Divekar – 2017-02-12T18:28:57.003

I do this by enabling and disabling the airplace mode using my laptop keyboard's function key shortcut – Spikatrix – 2020-01-25T03:00:06.237