8

Is there any way to retrieve all paired bluetooth devices ("Friendly name" and MAC-Adress) from the console? Is there any universal solution for any Linux distribution?

In case there isn't: I'm using an Ubuntu derivative.

I already tried some stuff with hcitool, but nothing worked so far...

3 Answers 3

7

Late to the party, I tried listing as suggested by @panmari and @MarkCh but I was getting some unknown mac addresses (on a C.H.I.P with Debian), so I used the following command:

 bt-device -l 

It will return both friendly name and Mac of all paired devices.

9

I found a solution myself. In Linux, the friendly names with their according mac adresses are saved in the file:

/var/bluetooth/{MAC-of-local-Bluetooth-device}/names

It should be easy enough to read it out with a shell script or the programming language of your choice.

2
  • 5
    It's /var/lib/bluetooth/{MAC-of-local-Bluetooth-device}/names on raspberry pi, but near enough, thanks!
    – Mark Ch
    Oct 16, 2015 at 8:32
  • 1
    This directory does not exist on Ubuntu 17, nor the file names, but /var/lib/bluetooth/<addr>/<addr>/info exists
    – Jellicle
    Dec 3, 2017 at 2:05
5

Install bluez-utils, run bluetoothctl paired-devices. See bluetoothctl --help for more useful commands.

1
  • I am using Raspian on Raspberry Pi 4 and connected my Bluetooth keyboard via the GUI. After setting boot mode to CLI it did not work anymore. bluez-tools (now bluez) was already installed. After starting bluetoothctl I saw with the command paired-devices, that no keyboard was connected. With scan on I was able to find out the device address and pair it with pair <address>, trust it with trust <address> and connect it with connect <address> Feb 20, 2021 at 21:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .