🍗 Wiki

Bluetoothctl

Bluetoothctl

Bluetoothctl is a tool to manage and control bluetooth interface. You can pair and connect your Linux device with it.

You can use the bluetoothctl if the bluez-utils is installed in your system.

1. Prepare your Linux machine ready to use bluetoothctl

You can check if the kernel recognized bluetooth hardware module.

$ dmesg | grep -i blue       # To filter out dmesg lines with 'blue(tooth)'

If you plugged a Bluetooth USB dongle to your Linux machine, make sure the btusb kernel module is loaded.

$ ls /lib/modules/$(uname -r)/kernel/drivers/bluetooth
$ sudo modprobe btusb     # Load the btusb kernel module

And check if the modules are loaded.

$ lsmod | grep blue
$ lsmod | grep btusb

You might want to check the bluetooth service is running.

service bluetooth status
service bluetooth start
service bluetooth enable  # Start bluetooth service right after the booting

2. Set up bluetooth interfaces

If you can see bluetooth interfaces from these commands, you can believe your Linux machine is ready to work with the bluetoothctl.

hciconfig -a
# or
bluetoothctl list

You can query the detailed information of the interface.

$ bluetoothctl show <MAC address>

3. Pair and Connect bluetooth devices to your Linux machine

Scan the pairable bluetooth gadgets nearby.

bluetoothctl scan on
# ...and stop scan if you desired.
bluetoothctl scan off

If you found the device you want to pair, it is time to pair.

bluetoothctl pair <MAC address>

If successfully paired, now you can connect it!

bluetoothctl connect <MAC address>