Turn on/off Bluetooth from shell not from applet
Ubuntu 13.04 64 bits, on ELiteBook 8740, gnome desktop with bluetooth-applet shown.
I could not figure out how to turn on and off from shell the Bluetooth and not from the notification bt applet menu. I need to turn on the service and the thing from menu from shell or C.
service bluetooth start/stop
has noting to do with the applet button menu item because here are the four scenarios I can see.
-
Service off, menu item from applet is off (shows turn on)
bt-device --list
yields bluez service is not found -
Service on, (
sudo service bluetooth start
) menu item from applet is off (shows turn on)bt-device --list
yields rg.bluez.Error.NoSuchAdapter: No such adapter -
Service on, menu item from applet is on (shows turn off)
bt-device --list
yieldsAdded devices: HMDX JAM (36:8F:E8:07:B2:CA) Mint Speaker (5BA5) (01:19:53:4C:5B:A5)
-
Service off, menu item from applet is on (shows turn off)
bt-device --list
yields bluez service is not found
I want to be able to turn on and off the Bluetooth as is being done from the applet button. How can I do this?
The commands you're looking for are:
rfkill block bluetooth
and
rfkill unblock bluetooth
To stop :
sudo /etc/init.d/bluetooth stop
To start :
sudo /etc/init.d/bluetooth start
To restart :
sudo /etc/init.d/bluetooth restart
On Ubuntu 15.04 and later
systemctl start bluetooth
for turning on Bluetooth
systemctl stop bluetooth
for turning off Bluetooth
systemctl restart bluetooth
for restarting Bluetooth