You can also use the rfkill command to disable or enable the Wi-Fi interface(s). This is how the interface is disabled by RaspbianRaspberry Pi OS (Raspbian) with a new installation before the country has been configured in the Wi-Fi settings (e.g using raspi-config). You can disable the Wi-Fi interface(s):
sudo rfkill block wifi Enable it like this:
sudo rfkill unblock wifi And check the current state of the interfaces:
rfkill list If you want enable/disable specific interfaces use the index shown by rfkill list to the un/block command. For example, you can usually just block the built-in WiFi interface like this (if this doesn't always control the correct interface see this question for more details):
rfkill block wifi 0 The rfkill state will be maintained across reboots as it is reinstated on bootup by the systemd-rfkill service.