Pairing Bluetooth headphones in command line

How do you pair bluetooth headphones without using the GUI? I don't know how to.

I found different method on the internet but nothing works.

I can actually see my headphones with the command : hcitool scan

then i try to connect with : hcitool cc 00:00:00:00:00:00 and hcitool auth 00:00:00:00:00:00

I haven't received an error message but my headphones are not working.

thanks for your time.


Solution 1:

from bluetooth connectivity troubleshooter on blog

  • if you don't know the MAC do : bt-device -l | grep <name of your device>
  • now that you have the MAC connect with: bluetoothctl connect <MAC HERE>

Now put this in your profile:

alias headphones="until bluetoothctl connect <MAC HERE>; do  echo ...  ; sleep 1; done"

** MAC HERE will be the MAC you found in previous steps

It might fail a few times because of bt connectivity and latency of connections but it works after 3 tries for me.

  • Using Ubuntu 19.10 on DELL Latitude
  • connecting HD 4.50BTNC headphones.

Solution 2:

You can use bluez-tools.

Install it by running sudo apt-get install bluez-tools.

Find the MAC address of your device with bt-device -l and connect to it with bt-audio -c 00:00:00:00:00:00.