How to Manage Bluetooth Devices on Linux Using bluetoothctl
Bluetooth technology has revolutionized the way we connect our electronic devices. Connecting devices such as speakers, headphones, or even smartphones is now easier than ever. Linux distributions have been quick to adopt Bluetooth technology and have included tools such as bluetoothctl to control and manage their Bluetooth devices. In this article, we will look at how to manage Bluetooth devices on Linux using bluetoothctl.
What is Bluetoothctl?
Bluetoothctl is a command-line interface that allows users to configure, manage, and monitor Bluetooth devices on Linux. This tool allows you to pair and connect devices, issue commands, and monitor the Bluetooth status of your system. It is a powerful tool that can do everything from discovering devices to modifying their power settings.
How to use Bluetoothctl?
Bluetoothctl is a command-line interface, so you will need to open a terminal to access it. You can launch a terminal by pressing Ctrl+Alt+T on Ubuntu-based distributions or by searching for “Terminal” in your application menu.
Once you have your terminal open, the first step is to initiate the Bluetooth service. You can do this by executing the following command:
“`
$ sudo systemctl start bluetooth
“`
Next, you can check the status of your Bluetooth service by running:
“`
$ sudo systemctl status bluetooth
“`
If the service is running, you should see a message that reads “active (running).”
Now you are ready to pair your Bluetooth device. To do this, run the following command:
“`
$ bluetoothctl
“`
This will open the bluetoothctl interactive prompt. From here, you can use various Bluetooth commands to configure and manage your devices.
“`
bluetoothctl> power on
“`
The first command you should run is “power on.” This command will enable Bluetooth on your Linux system.
“`
bluetoothctl> agent on
“`
Once Bluetooth is enabled, you can now turn on the agent by running the above command. The agent is a program that handles Bluetooth pairing requests.
“`
bluetoothctl> scan on
“`
Now we have enabled Bluetooth, turned on the agent, and we’re ready to scan for new Bluetooth devices in range. You can do this by running the “scan on” command.
“`
bluetoothctl> pair XX:XX:XX:XX:XX:XX
“`
Once the scan is complete, you will see a list of Bluetooth devices that are within range. Find the device you want to pair with and copy its Bluetooth MAC address. Then, pair the device by running:
“`
bluetoothctl> trust XX:XX:XX:XX:XX:XX
“`
To connect and trust the device, you will need to run the “trust” command, followed by the MAC address of the device. This will ensure that your device will automatically connect to your system in the future.
“`
bluetoothctl> connect XX:XX:XX:XX:XX:XX
“`
Finally, you can connect to the paired device by running the “connect” command followed by the MAC address of the device.
Conclusion
Bluetoothctl is a powerful tool that allows you to manage your Bluetooth devices on Linux. The above steps should have helped you get your device paired and connected to your system. With this tool, you can configure and monitor your Bluetooth devices from the comfort of your Linux terminal. With a little bit of practice, you can become an expert at using bluetoothctl to manage your Bluetooth devices.