Pair Bluetooth Device from a Terminal
Pairing and connecting to a bluetooth device from a terminal is useful when you are working with a single-board computer and you don't have a monitor connected to it.
Start the Bluetooth control utility
Install bluetooth tools if you haven't:
Start the control utility:
You should get into the bluetoothctl prompt mode:
Commands with the bluetoothctl prompt
- Turn on Bluetooth
- Enable agent
- Scan for nearby devices
Wait for the device you want to pair with to appear in the list. Once it appears, note down its MAC address.
- Pair with the device
- Connect to the device
- Exit the Bluetooth control utility (or simply use Ctrl + D)
Note you can also use the above command from the normal terminal prompt in the form: bluetoothctl + [command]
, such as
Reference
- [1] https://www.geeksforgeeks.org/connecting-to-bluetooth-devices-via-cli/
- [2] https://www.baeldung.com/linux/bluetooth-via-terminal