1. rfkill command
rfkill
The command comes from the abbreviation of the English phrase “radio frequency kill”
whose function is to manage Bluetooth and devices in the system WiFi
. rfkill
The command is a kernel-level management tool that turns Bluetooth and features on or off in the system WiFi
.
usage
rfkill [参数] 设备名
Optional parameters
parameter | Function |
---|---|
block | Turn off the device |
list | List available devices |
unblock | Turn on the device |
–version | Print version information |
Usage example:
List all WiFi
Bluetooth devices in the current system.
[root@Linux-IM ~]# rfkill list
0: hci0: Bluetooth
Soft blocked: yes
Hard blocked: no
1: phy0: Wireless LAN
Soft blocked: yes
Hard blocked: no
Close the specified numbered device.
[root@Linux-IM~]# rfkill block 1
[注]:这样就可以关闭无线设备了。
2.nmcli command
In fact, nmcli
all network devices can be managed, here is just how to use it to turn off or turn on the wireless network.
Turn off wireless network command
[root@Linux-IM~]# nmcli radio wifi off
Or abbreviated as follows
[root@Linux-IM~]# nmcli r wifi off
Enable wireless network command
[root@Linux-IM~]# nmcli radio wifi on
Or abbreviated as follows
[root@Linux-IM~]# nmcli r wifi on
Disable all networks
[root@Linux-IM~]# nmcli networking off