To manage Bluetooth devices on an Ubuntu Server without a graphical interface, you can utilize the bluetoothctl command-line tool provided by the BlueZ package. Here's a step-by-step guide:
-
Ensure Bluetooth Service is Running:
First, verify that the Bluetooth service is active:
sudo systemctl status bluetooth
If it's not running, start and enable it:
sudo systemctl start bluetooth
sudo systemctl enable bluetooth
-
Launch bluetoothctl:
Open the Bluetooth control tool:
bluetoothctl
This will open an interactive shell for Bluetooth management.
-
Power On the Bluetooth Controller:
Within the bluetoothctl prompt, turn on the Bluetooth controller:
power on
-
Set the Controller to Pairable and Discoverable:
Allow the controller to be discoverable and pairable:
pairable on
discoverable on
-
Start Scanning for Devices:
Initiate scanning to discover nearby Bluetooth devices:
scan on
As devices are found, their MAC addresses and names will be displayed.
-
Pair with a Device:
Once your target device appears, pair with it using its MAC address:
pair XX:XX:XX:XX:XX:XX
Replace XX:XX:XX:XX:XX:XX with the actual MAC address of the device.
-
Trust the Device:
Mark the device as trusted to allow automatic connections in the future:
trust XX:XX:XX:XX:XX:XX
-
Connect to the Device:
Establish a connection to the device:
connect XX:XX:XX:XX:XX:XX
-
Exit bluetoothctl:
After successfully connecting, you can exit the interactive shell:
exit
This approach allows you to manage Bluetooth devices entirely through the command line on Ubuntu Server.