Using a RaspberryPi in your home can greatly reduce costs and allow you to tinker around with new and interesting projects, commonly many people use their RaspberryPi wirelessly. But how do you disable the adapter when it is no longer needed?
Temporary Disable (Until Reboot)
Use the following command to disable Wi-Fi temporarily:
sudo ifconfig wlan0 down
To re-enable it:
sudo ifconfig wlan0 up
This first method is only temporary, the WiFi adapter will reenable once a reboot has happened. For you to keep the Wi-Fi adapter disabled follow the below guide:
Using rfkill
You can block Wi-Fi with the following command:
sudo rfkill block wifi
To unblock it later:
sudo rfkill unblock wifi
If you want this change to persist across reboots, create a systemd service:
- Create the service file:
sudo nano /etc/systemd/system/disable-wifi.service - Add the following content:
ini[Unit]Description=Disable Wi-FiAfter=multi-user.target[Service]Type=oneshotExecStart=/usr/sbin/rfkill block wifi[Install]WantedBy=multi-user.target - Save and exit the file (
Ctrl+O, thenCtrl+X). - Enable the service:
sudo systemctl enable disable-wifi
Be sure to check out our other Tutorial posts for more information:
Feel free to also try something else, such as setting up your own ad blocker using PiHole!
Leave a Reply