How to Enable and Disable Wireless / WiFi from command line ?

Rfkill is a tool for enabling and disabling wireless devices. We use “rfkill list” command as below to check the list of available wireless devices on our machine. This command returns the devices and its index 0, 1, 2 as below,

 $ rfkill list
0: phy0: Wireless LAN
	Soft blocked: no
	Hard blocked: no
1: brcmwl-0: Wireless LAN
	Soft blocked: no
	Hard blocked: no
3: hci0: Bluetooth
	Soft blocked: no
	Hard blocked: no

As seen above we have a WiFi, LAN and Bluetooth supported and ON in my laptop. Now lets try turning ON & OFF these wireless devices using rfkill as,

Turn OFF WiFi

 $ rfkill block wifi 

OR using “rfkill list” index,

 $ rfkill block 0 

Turn ON WiFi

 $ rfkill unblock wifi 

OR using “rfkill list” index,

 $ rfkill unblock 0 

You may check “man rfkill” to see more details.

$ rfkill 
Usage:	rfkill [options] command
Options:
	--version	show version (0.5-1ubuntu3 (Ubuntu))
Commands:
	help
	event
	list [IDENTIFIER]
	block IDENTIFIER
	unblock IDENTIFIER
where IDENTIFIER is the index no. of an rfkill switch or one of:
	 all wifi wlan bluetooth uwb ultrawideband wimax wwan gps fm nfc

Leave a Comment