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
	--version	show version (0.5-1ubuntu3 (Ubuntu))
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 Application Stack / User Interface Bash / Shell Scripts Commands and Packages Compilation Content Management System - CMS Core Kernel C Programs Development & Build Development Environment Setup Errors & Failures Flutter git Go Language Programs Hardware Platforms HTML JAVA Programs Kernel & Device Drivers Linux, OS Concepts and Networking Linux Device Drivers Linux Host, Ubuntu, SysAdmin Linux Kernel Linux Networking Middleware Libraries, HAL Monetization / Google AdSense NDK / Middleware / HAL OS Concepts PHP Programming Languages RaspberryPi Scripting and Automation Search Engine Optimisation ( SEO ) Social Media Socurce Code Management ( SCM ) System Administration, Security Testing and Debugging Uncategorized User Interface Userspace Utilities Web design and development Wordpress Yocto / Bitbake / Openembedded

Leave a Reply / Ask Question