Linux Bluetooth Devices List
When it comes to listing Bluetooth (BT) devices in Linux, the process is quite straightforward and efficient. Linux offers several commands and tools to help you identify connected and available Bluetooth devices with ease. Let's dive into the world of Linux Bluetooth device listing.
Bluetooth was designed to connect various devices, such as keyboards, mice, headphones, and even smartphones. Linux, with its robust ecosystem of tools and utilities, provides seamless integration with these devices. Before we proceed, ensure your Linux distribution has the bluez package installed, which is essential for Bluetooth functionality.
Listing Connected Devices
First, let's explore how to list the devices currently connected to your Linux machine.
1. **Using the `hcitool` command:** The `hcitool` command is a part of the bluez package and is designed to manage Bluetooth devices. To list the connected devices, use the following command:
hcitool con
2. **Using the `bluetoothctl` tool:** The `bluetoothctl` tool is a recent addition to the bluez package, providing an interactive command-line Bluetooth manager. To list connected devices, follow these steps:
- Open a terminal and run `bluetoothctl` to start the interactive shell.
- Enter the `devices` command to list connected devices.
Listing Available Devices
Now, let's see how to list the Bluetooth devices available for pairing and connection.
1. **Using the `hcitool` command:** Similar to listing connected devices, you can use `hcitool` to scan for nearby devices with the `inquiry` command. Replace `scan_time` with the desired scan time in seconds:
hcitool scan --pru scan_time
2. **Using the `bluetoothctl` tool:** In the `bluetoothctl` interactive shell, enter the `scan on` command to start discovery. After a few seconds, enter `devices` to view the list of discovered devices:
- `scan on` - Starts discovery mode.
- `devices` - Lists the discovered devices.
- `scan off` - Stops discovery mode.
Using `systemd` for Bluetooth Services
The `systemd` system and service manager in Linux provides a convenient way to manage Bluetooth services. Let's explore how to use it to list Bluetooth devices.
1. **Listing connected devices with `systemd`:** To list the connected devices using `systemd`, use the following command:
systemctl -t device list | grep -E 'bluetooth|devices/by-id/usb-.*BT|rfkill' | grep -i 'present: 1$'
2. **Listing available devices with `systemd`:** To list available devices, use the following command, replacing `target` with the Bluetooth adapter's MAC address:
systemctl -t device list |
awk '/[0-9A-F]{2}:[0-9A-F]{2}:[0-9A-F]{2}:[0-9A-F]{2}:[0-9A-F]{2}:[0-9A-F]{2}/ &&
/'target disant: présents/ {print $1}
Managing Devices with `blue dni`
The `blue dni` command-line utility allows you to manage devices and services using the D-Bus network. You can list devices using the following command:
blue dni list --device
This should provide you with a comprehensive list of Bluetooth devices connected to your Linux system. From here, you can easily pair and connect to devices as needed.
In the ever-evolving landscape of Linux, staying up-to-date with the latest tools and commands ensures a smooth and efficient Bluetooth experience. Keep exploring and expanding your Linux prowess!