how to disable wifi on ubuntu server

How To Disable Wi-Fi On Ubuntu Server (3 easy ways)

There isn’t an easy way to manage your Wi-Fi network on Ubuntu Server. I previously shared a tutorial on how to configure your wireless connection, but disabling it, either temporarily or permanently, is another topic. Let’s learn a few different ways to do this on Ubuntu Server.

To disable the Wi-Fi on Ubuntu, the command “ip link set dev <device> down” can be used natively. The device name can be found with “ip a“, but additional packages can provide methods easier to remember.

Don’t worry, I’ll explain all the steps in detail in this article, and I’ll also show you two other methods that are easier and possibly more convenient, depending on your needs.

Linux doesn’t have to be intimidating. With my e-book, Master Linux Commands, you’ll uncover the secrets of the terminal in a fun, step-by-step journey. From basics to scripts, get ready to level up your Linux skills. Oh, and did I mention the handy cheat sheet you get as a bonus?

1 – No package required: the “ip” command

The first way to disable Wi-Fi on Ubuntu Server is to use the “ip” command, which is included in any new installation. The advantage of this method is that it works natively, and the downside is that the command isn’t necessarily easy to remember.

Prerequisite: Get information about your Wi-Fi interface

In the command line we’ll use, you need the name of your Wi-Fi adapter. On Ubuntu and most Linux distributions, it’s no longer “wlan0” on all computers, so it’s better to take the time to check your current device name.

You can get a list of your interfaces with the command:
ip a

As you can see on this screenshot, you’ll get one paragraph for each active interface:

  • lo: the local interface, you can ignore it.
  • eth0 or similar: the RJ45 interface(s). That’s not the topic of this article, you can skip it.
  • wlp2so or wlan0 or similar: it’s what we are looking for. Note the interface name at the beginning of the paragraph (wlp2s0 in my example), as you’ll need it later.

If you’re new to the Linux command line, this article will give you the most important Linux commands to know, plus a free downloadable cheat sheet to keep handy.

Your Go-To Linux Command Reference!
Download your exclusive free PDF containing the most useful Linux commands to elevate your skills!
Download now

Disable the Wi-Fi interface in one command

Once you know which interface should be disabled, you can do it with the following command syntax:
sudo ip link set dev <interface> down

So, with my example, I did:
sudo ip link set dev wlp2s0 down

The interface is disabled immediately (so you’ll lose access to your server if you were connected via the Wi-Fi connection). You can get it back up with:
sudo ip link set dev wlp2s0 up

Join Our Community!

Connect, learn, and grow with other Raspberry Pi enthusiasts. Support RaspberryTips and enjoy an ad-free reading experience. Get exclusive monthly video tutorials and many other benefits.

Learn more

Or it will be enabled again on the next reboot of your server.

This solution is great as no additional package or configuration file is required, but the command isn’t easy to remember (especially if you don’t use it regularly). You can maybe create an alias for it, or just check the following solutions to see if you can install additional tools on your server.

2 – Easiest command to remember (tlp package)

The “tlp” package provides an easy method to enable or disable the Wi-Fi interface on any Ubuntu system. It comes with all the required dependencies and adds an easy command to enable or disable the wireless connection.

First, you need to install the package with:
sudo apt install tlp

Warning: as you can see on the screenshot, it comes with a bunch of additional packages (network-manager, rfkill, dnsmasq, etc.). If you need this on a production server, I will test it first on another machine and evaluate the impact.
I tested with a basic network configuration, and it worked well, but I can’t guarantee it won’t break anything with a more advanced setup (static IP, etc.).

Once the tlp package is installed, you can simply use this command to disable the Wi-Fi interface:
sudo wifi off

Your Go-To Linux Command Reference!
Download your exclusive free PDF containing the most useful Linux commands to elevate your skills!
Download now

It can’t be easier to remember.

The Wi-Fi connection is disabled immediately, and won’t get back up on reboot. You can enable it again with:
sudo wifi on

In the background, I think it uses the third method I give you in the next section. But making it easier to use. So, just use the next solution if you are worried about all the packages that come with tlp.

Your Go-To Linux Command Reference!
Download your exclusive free PDF containing the most useful Linux commands to elevate your skills!
Download now

3 – Light and definitive solution: rfkill

Rfkill is a tool available on Linux that provides the interface between the kernel and the wireless adapters. It adds several commands once installed, and a configuration file, allowing us to completely disable some of these adapters.

First, you may need to install the package with:
sudo apt install rfkill

Once installed, we need to get a list of the physical interface detected on your system. It’s not the same name as with the first method, we use a different command:
rfkill list

In my example, two interfaces are detected:

  • 0 – hci0: The Bluetooth adapter.
  • 1 – phy0: The wireless adapter.

You can also check their current status with this command. By default, none of them are blocked. That’s what we’ll change to disable the Wi-Fi interface.

To disable (block) an interface, use the command syntax:
sudo rfkill block <device-id>
So, for example, to disable the Wi-Fi interface from my screenshot, I’ll do:
sudo rfkill block 1

The interface is disabled immediately, and won’t come back up on the next reboot. It will stay disabled until you decide to unblock it with:
sudo rfkill unblock 1

And do a reboot after that:
sudo reboot

You now know three methods to disable your Wi-Fi on Ubuntu Server, and it doesn’t need to be complicated.

I like the first one for temporary deactivation and the second for a command that is easy to remember and use. The last one can be useful when you don’t want to add too many packages on a server.

Other options are available, like using “nmcli” or the “iw” command, but I don’t think they add anything to this list, so I won’t bother you with them.

Anyway, if you are interested in Ubuntu Server, here are a few other articles on the website I would recommend:

Your Go-To Linux Command Reference!
Download your exclusive free PDF containing the most useful Linux commands to elevate your skills!
Download now

🛠 This tutorial doesn't work anymore? Report the issue here, so that I can update it!

Reminder: Remember that all the members of my community get access to this website without ads, exclusive courses and much more. You can become part of this community for as little as $5 per month & get all the benefits immediately.

Additional Resources

Overwhelmed with Linux commands?
My e-book, “Master Linux Commands”, is your essential guide to mastering the terminal. Get practical tips, real-world examples, and a bonus cheat sheet to keep by your side.
Grab your copy now.

VIP Community
If you just want to hang out with me and other Linux fans, you can also join the community. I share exclusive tutorials and behind-the-scenes content there. Premium members can also visit the website without ads.
More details here.

Need help building something with Python?
Python is a great language to get started with programming on any Linux computer.
Learn the essentials, step-by-step, without losing time understanding useless concepts.
Get the e-book now.

Similar Posts