On Raspberry Pi OS, you can use the rfkill command to turn wireless functions on and off.
The rfkill command can turn Wi-Fi and Bluetooth on and off.
Test Environment
Raspberry Pi OS - Debian GNU/Linux 12 (bookworm)
Raspberry Pi 5 8GB Model: Raspberry Pi 5 Model B Rev 1.0 (Rev. d04170)
Raspberry Pi 4 8GB Model: Raspberry Pi 4 Model B Rev 1.4 (Rev. d03114)
Check the Device ID
Check the number in the ID column. In the example below, the Bluetooth device is 0 and Wi-Fi is 1.
$ rfkill
ID TYPE DEVICE SOFT HARD
0 bluetooth hci0 unblocked unblocked
1 wlan phy0 unblocked unblockedDisable Wi-Fi
You can stop it with block.
$ rfkill block 1
$ rfkill
ID TYPE DEVICE SOFT HARD
0 bluetooth hci0 unblocked unblocked
1 wlan phy0 blocked unblockedStop Wi-Fi and Bluetooth
block all stops both.
$ rfkill block all
$ rfkill
ID TYPE DEVICE SOFT HARD
0 bluetooth hci0 blocked unblocked
1 wlan phy0 blocked unblockedEnable Wi-Fi
You can restore it with unblock.
$ rfkill unblock 1
$ rfkill
ID TYPE DEVICE SOFT HARD
0 bluetooth hci0 blocked unblocked
1 wlan phy0 unblocked unblockedDisable the Wi-Fi Module
If you want to stop it at the hardware level, add dtoverlay=disable-wifi near the end of config.txt. If you also want to stop Bluetooth, add dtoverlay=disable-bt.
A reboot is required for the settings to take effect.
$ sudo vi /boot/firmware/config.txt
Disable Wi-Fi H/W Module
dtoverlay=disable-wifi
Disable onboard Bluetooth
dtoverlay=disable-bt
$ sudo reboot
H/Wをオフにすると rfkill には表示されなくなる
$ rfkill
$
Reference
https://github.com/raspberrypi/firmware/blob/master/boot/overlays/README