Friday, September 5, 2014

[Quick Tips] : ENABLE DISABLE WIRELESS thru Command Line

USE RFKILL TO ENABLE/DISABLE WIRELESS ON YOUR LINUX LAPTOP


rfkill’s list command lets you see all the available devices, if you don’t find any of your devices, make sure you have turned the hardware switch ON and have installed the drivers for each. Here is what I get on my system after enabling the hardware switch:
kartik@PlatiniumLight ~ $ rfkill list
0: brcmwl-0: Wireless LAN
Soft blocked: yes
Hard blocked: no
1: dell-wifi: Wireless LAN
Soft blocked: yes
Hard blocked: no
2: dell-wwan: Wireless WAN
Soft blocked: yes
Hard blocked: yes
3: hci0: Bluetooth
Soft blocked: no
Hard blocked: no
kartik@PlatiniumLight ~ $
Apart from Bluetooth, I usually find all other devices to be in a random state of yes or no. To enable them, issue the unblock command as shown:
kartik@PlatiniumLight ~ $ rfkill unblock 0
kartik@PlatiniumLight ~ $ rfkill unblock 1
kartik@PlatiniumLight ~ $ rfkill unblock 2
kartik@PlatiniumLight ~ $ rfkill list
0: brcmwl-0: Wireless LAN
Soft blocked: no
Hard blocked: yes
1: dell-wifi: Wireless LAN
Soft blocked: no
Hard blocked: no
2: dell-wwan: Wireless WAN
Soft blocked: no
Hard blocked: no
3: hci0: Bluetooth
Soft blocked: no
Hard blocked: no
kartik@PlatiniumLight ~ $
You can also try using the unblock all command for enabling all the devices together:
kartik@PlatiniumLight ~ $ rfkill unblock all
Sometimes it happens that even after unblocking once, some device(s) may show up as blocked (see the 0th device above, which shows hard blocked as yes). To correct this just issue the unblock command again for that particular device:
kartik@PlatiniumLight ~ $ rfkill unblock 0
kartik@PlatiniumLight ~ $ rfkill list
0: brcmwl-0: Wireless LAN
Soft blocked: no
Hard blocked: no
1: dell-wifi: Wireless LAN
Soft blocked: no
Hard blocked: no
2: dell-wwan: Wireless WAN
Soft blocked: no
Hard blocked: no
3: hci0: Bluetooth
Soft blocked: no
Hard blocked: no
kartik@PlatiniumLight ~ $
When you get all the devices unblocked, you will not face any trouble connecting to wi-fi devices around.  Use rfkill to Enable/Disable Wireless on your Linux Laptop
Bonus Tip: If you have a common hardware switch for wireless radios, you can turn off additional devices like Bluetooth (or vice versa) to save some battery life using the block command of rfkill:
kartik@PlatiniumLight ~ $ rfkill block 3
kartik@PlatiniumLight ~ $ rfkill list
0: dell-wifi: Wireless LAN
Soft blocked: no
Hard blocked: no
1: dell-wwan: Wireless WAN
Soft blocked: no
Hard blocked: no
2: brcmwl-0: Wireless LAN
Soft blocked: no
Hard blocked: no
3: hci0: Bluetooth
Soft blocked: yes
Hard blocked: no
kartik@PlatiniumLight ~ $
Stay Digified!

No comments: