Code Yarns ‍👨‍💻
Tech BlogPersonal Blog

How to handle Bluetooth devices from shell

📅 2014-Aug-24 ⬩ ✍️ Ashwin Nanjappa ⬩ 📚 Archive

Bluetooth devices can be listed, connected and disconnected by clicking the Bluetooth icon in the top Panel in the Ubuntu Unity desktop. If you prefer to do these simple operations from the commandline, that can be done too.

To do this, we need the tools from the bluez-tools package:

$ sudo apt install bluez-tools

To list all the devices that have paired in the past:

$ bt-device --list

This lists each device with its name and UUID. The UUID of a device can be used to connect or disconnect from it.

To connect an audio device using its UUID, say 00:02:3C:2F:F1:D4:

$ bt-audio --connect 00:02:3C:2F:F1:D4

To disconnect the same audio device:

$ bt-audio --disconnect 00:02:3C:2F:F1:D4

Tried with: Bluez-tools 0.1.38 and Ubuntu 14.04