Linux Commands

How to Enable/Disable WiFi Devices from the Command-Line on Linux Using NetworkManager

Keeping the WiFi devices disabled when you don’t need them will save the battery life of your device. It also improves the security as your Linux system won’t be able to connect to open the WiFi networks nearby. Opennig the WiFi networks don’t require a password to connect to and the devices often connect to those open WiFi networks automatically when no known/saved WiFi networks are available nearby. Some hackers keep their WiFi network open so that they can perform a man-in-the-middle attack on you and they can steal a sensitive information by monitoring the traffic. So, unknown open WiFi networks are unsafe and should be avoided at all costs.

In this article, we will show you how to enable or disable the WiFi network devices from the command line on modern Linux distributions that use the NetworkManager to manage the network devices.

This article should work on the following listed Linux distributions and other Linux distributions (not listed) that use the NetworkManager to manage the networks and have the “nmcli” command-line tool available.

  • Ubuntu
  • Debian
  • Linux Mint
  • Elementary OS
  • Fedora
  • RHEL
  • CentOS Stream
  • AlmaLinux
  • Rocky Linux
  • openSUSE
  • SUSE Linux Enterprise Server (SLES)
  • Oracle Linux

Topic of Contents:

  1. Checking If the WiFi Is Enabled/Disabled from the Command Line on Linux Using Nmcli
  2. Disabling the WiFi from the Command Line on Linux Using Nmcli
  3. Enabling the WiFi from the Command Line on Linux Using Nmcli
  4. Conclusion

Checking If the WiFi Is Enabled/Disabled from the Command Line on Linux Using Nmcli

You can check the current status (enabled/disabled) of your WiFi device from the command line on Linux as follows:

$ sudo nmcli radio wifi

As you can see, the WiFi devices are enabled in our case.

Disabling the WiFi from the Command Line on Linux Using Nmcli

If you want to disable the WiFi devices of your Linux system, run the following command:

$ sudo nmcli radio wifi off

As you can see, the WiFi devices are disabled.

$ sudo nmcli radio wifi

Enabling the WiFi from the Command Line on Linux Using Nmcli

To enable the WiFi devices on your Linux system, run the following command:

$ sudo nmcli radio wifi on

As you can see, the WiFi devices are enabled.

$ sudo nmcli radio wifi

Conclusion

In this article, we showed you how to check if the WiFi devices are disabled/enabled on your Linux system from the command line using the “nmcli” NetworkManager management tool. We also showed you how to enable/disable the WiFi devices on your Linux system from the command line using “nmcli”. Disabling the WiFi devices when you don’t need them improves battery life and security.

About the author

Shahriar Shovon

Freelancer & Linux System Administrator. Also loves Web API development with Node.js and JavaScript. I was born in Bangladesh. I am currently studying Electronics and Communication Engineering at Khulna University of Engineering & Technology (KUET), one of the demanding public engineering universities of Bangladesh.