How to disable wireless from command line

How do you disable the wireless Internet from the command line?

I tried sudo ifconfig eth1 down but network-manager seems to ignore this and keeps trying to reactivate it. What's worse is the network-manager widget doesn't let you disable it either once it starting "trying to connect". Whenever I'm near a spotty connection, it just keeps trying and trying to connect, failing each time and showing an annoying error message, "sorry, we couldn't connect".


The command-line equivalent in ubuntu 16.04

nmcli radio wifi off

To re-enable, use

nmcli radio wifi on

To help

nmcli radio help   
nmcli radio wifi help

Enable/disable networking completely

nmcli networking off

Just for WiFi

nmcli radio wifi off

On both cases on to re-enable.

If you need to permanently disable a particular device, then you can do that programatically using the unmanaged-devices feature in /etc/NetworkManager/NetworkManager.conf or (at a lower level) by blacklisting or removing the corresponding driver.


For older versions than v0.9.10

  • Use nm instead of networking. See nmcli man page.
  • Table with differences between nmcli v0.9.8 vs. v0.9.10.
  • The top-level nm object no longer exists, and the equivalent nm wifi options are now provided by a radio object.
  • The nmcli interface changed significantly between v0.9.8 and v0.9.10, and the documentation notes that:

Even if nmcli tries to keep backwards compatibility in general, there were requirements during Networkmanager development that forced some incompatible changes in nmcli. The table bellow list differences between 0.9.8 and 0.9.10.


In general, simple

sudo ifconfig wlan0 down

...should be enough. Sometimes, wireless card can be shown as

ethX

instead of

wlanY

then you need to double check which ethX to disable and you can do it with

sudo lshw -C network

and look for your wireless card entry inside which you will find:

logical name: <ethX_or_wlanY_goes_here>

I guess you probably know and your problem is bigger then that but at the same time, probably lots fresh of people will find this topic and this should be enough for them.


A method no one mentioned:

rfkill list to view wireless/bluethoot devices

rfkill block <device number> to (soft) block it