Connecting Bluetooth Peripherals via terminal in Linux

Let’s say you’re device has a Bluetooth installed and wanna play around it with the terminal rather than a boring GUI which not so cool people do, you know what I’m saying geeks here like to play with the terminal right 🙂

Before start, make sure your device has a Bluetooth interface or else get a cheap USB Bluetooth dongle.

$ sudo apt install bluetooth

This will install bluetoothctl and bluetoothd.
Start the bluetooth service.

$ sudo service bluetooth start
$ sudo bluetoothctl
[bluetooth] agent on
[bluetooth] default-agent
[bluetooth] scan on
[bluetooth] devices
[bluetooth] pair <bluetooth_mac_address>

If you’re pairing a Bluetooth keyboard, it will show a key to pair the keyboard. Type that key using the Bluetooth keyboard and press enter key to get paired. Finally,

[bluetooth] connect <bluetooth_mac_address>

Leave a Reply

Your email address will not be published. Required fields are marked *