Connect to a Bluetooth device from command line in Ubuntu Linux
Guide to pair a Bluetooth device from command line.
In this case I will pair a Bluetooth headphone but the process should be similar to any other device.
1. Identify your computer bluetooth
Identify the Bluetooth device we want to scan from with hcitool dev
.
$ hcitool dev
Devices:
hci0 A3:3E:XX:XX:G3:86
2. Scan available devices
Turn on your device (e.g. headphone) so we can find it from the
computer with hcitool scan
if we have just one or choose the right
one like hcitool -i hci0 scan
.
$ hcitool -i hci0 scan
Scanning ...
FC:XX:XX:XX:XX:FE n/a
3. Trust the discovered device
For future connections, trust the device using bluetoothctl
and
trust
the discovered MAC address.
$ bluetoothctl [bluetooth]# trust FC:XX:XX:XX:XX:FE [CHG] Device FC:XX:XX:XX:XX:FE Trusted: yes
4. Connect
You can connect it from the bluetoothctl
console or directly with bluetoothctl connect < MAC-address >
.
[bluetooth]# connect FC:XX:XX:XX:XX:FE Attempting to connect to FC:XX:XX:XX:XX:FE Connection successful [E7]#
Extras
Useful commands to deal with Bluetooth devices from bluetoothctl
:
help
devices
list available devicespaired-devices
list paired devices
[E7]# paired-devices
Device FC:XX:XX:XX:XX:FE E7
Resoureces
bluetoothctl
: - interactive bluetooth control tool (General Commands Manual)hcitool
- configure Bluetooth connections (Linux System Administration)
- Connect to a Bluetooth device from command line in Ubuntu Linux
- Add Infolinks Script To An Existing Website From Console With Sed CommandApril 4, 2017
- How to change all files permissions to 644 and directories to 755January 10, 2017
- Shell Redirect Output And Errors To The Null Device In BashDecember 9, 2016
- Prevent Running Of Duplicate Cron JobsDecember 8, 2016
- Delete All Backup Files Recursively In BashNovember 28, 2016
- Bash Script to Find Out If MySQL Is Running Or NotNovember 9, 2016
Articles
Except as otherwise noted, the content of this page is licensed under CC BY-NC-ND 4.0 . Terms and Policy.
Powered by SimpleIT Hugo Theme
·