bluetoothctl: list connected devices?
I'm trying to get a list of the connected BT devices in CLI on Kubuntu, but I can't seem to find how.
When I launch bluetoothctl
it defaults to the latest connected device, and I need to disconnect it to display the other one.
Is there a way to list the connected BT devices?
Solution 1:
Here's a fish-shell one-liner (see below for bash)
bluetoothctl devices | cut -f2 -d' ' | while read uuid; bluetoothctl info $uuid; end|grep -e "Device\|Connected\|Name"
bash one-liner:
bluetoothctl devices | cut -f2 -d' ' | while read uuid; do bluetoothctl info $uuid; done|grep -e "Device\|Connected\|Name"
Solution 2:
You can list paired devices with bluetoothctl paired-devices
From this list you can get info for each device with bluetoothctl info
On the info you have the Connected status.
So loop on each devices grep for Connected: yes
if so display the name:
bluetoothctl paired-devices | cut -f2 -d' '|
while read -r uuid
do
info=`bluetoothctl info $uuid`
if echo "$info" | grep -q "Connected: yes"; then
echo "$info" | grep "Name"
fi
done
Solution 3:
This may help: sudo bluetoothctl info MAC-ADDRESS-OF-DEVICE
Solution 4:
After running sudo bluetoothctl
...
you can type paired-devices
to see a list of paired devices
or list
to see a list of currently connected controllers
you can also type info
to see info about each device.
Each command here supports tab completion of MAC addresses.