How to Turn ON & OFF Bluetooth, LAN, Wireless / WiFi from command line in Ubuntu

Rfkill is a tool for enabling and disabling wireless devices.

 $ 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 Bluetooth

 $ rfkill block bluetooth 

Or using “rfkill index” bluetooth can be turned off as,

 $ rfkill block 3 

Now, as we can see in “rfkill list” Bluetooth is now turned OFF,

 $ rfkill list
3: hci0: Bluetooth
	Soft blocked: yes
	Hard blocked: no

Turn ON Bluetooth

 $ rfkill unblock bluetooth 

OR using “rfkill list” index,

 $ rfkill unblock 3 

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
Android Android Commands Android Java Applications Application Libraries Bash / Shell Scripts Bluetooth driver Build Frameworks Commands and Packages Core Kernel C Programs Development Environment Setup Documents / Books Errors & Failures File Systems Framebuffer / Display Driver git Go Language Programs Hardware Platforms Home JAVA Programs Kernel & Device Drivers Kernel Booting and Porting Linux, OS Concepts and Networking Linux Device Drivers Linux Host, Ubuntu, SysAdmin Linux Kernel Linux Networking Middleware Libraries, HAL NDK / Middleware / HAL Network Driver OS Concepts PHP Procfs Filesystem Programming Languages RaspberryPi Scripting and Automation Search Engine Optimisation ( SEO ) Socurce Code Management ( SCM ) System Administration, Security Testing and Debugging Uncategorized Userspace Utilities Web design and development Wordpress Yocto / Bitbake / Openembedded

Leave a Reply