Managing Bluetooth controllers and pairing wireless devices on Ubuntu Linux from the command line is executed using the interactive bluetoothctl utility from BlueZ.

bluetoothctl Terminal Commands

Terminal Commandsbash
# Launch interactive bluetoothctl shell
bluetoothctl
 
# Inside bluetoothctl shell:
power on
agent on
default-agent
scan on
 
# Pair and connect to target MAC address
pair XX:XX:XX:XX:XX:XX
connect XX:XX:XX:XX:XX:XX