linux list bt devices

Linux Bluetooth Devices List

By Nicole Martinez
AD

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.

AD
The Best Linux Software and Apps
The Best Linux Software and Apps
30 LINUX COMMANDS EVERY DEVELOPER SHOULD KNOW
30 LINUX COMMANDS EVERY DEVELOPER SHOULD KNOW
the linux must know commands list is shown in this screenshote image, and shows how to use them
the linux must know commands list is shown in this screenshote image, and shows how to use them

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:

the linux system tools list is shown in blue and red colors, with several icons on it
the linux system tools list is shown in blue and red colors, with several icons on it
25 LINUX TOOLS EVERY DEVELOPER SHOULD KNOW
25 LINUX TOOLS EVERY DEVELOPER SHOULD KNOW
the list of linux terminal hotkeys is shown in this screenshote image
the list of linux terminal hotkeys is shown in this screenshote image
  1. Open a terminal and run `bluetoothctl` to start the interactive shell.
  2. 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:

AD
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:

the linux directory guide is shown in black and white, with arrows pointing to different locations
the linux directory guide is shown in black and white, with arrows pointing to different locations
the basic linux commands are displayed in this screenshot
the basic linux commands are displayed in this screenshot
The 12 Best Linux Desktop Environments
The 12 Best Linux Desktop Environments
the linux security tools list is shown in this screenshote screengrafion
the linux security tools list is shown in this screenshote screengrafion
the linux and windows operating diagram for linux systems, which includes several different types of functions
the linux and windows operating diagram for linux systems, which includes several different types of functions
the linux networking cli tools list is shown in this screenshote, which includes several
the linux networking cli tools list is shown in this screenshote, which includes several
  • `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:

AD
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:

the basic linux commands are displayed in black and white, as well as some other words
the basic linux commands are displayed in black and white, as well as some other words
a computer screen with the words linux commands on it and an image of a keyboard
a computer screen with the words linux commands on it and an image of a keyboard
the most used linux commands info
the most used linux commands info
the linux application is shown with icons and text, including an image of a computer
the linux application is shown with icons and text, including an image of a computer
Top Linux commands
Top Linux commands
the ubuntu chat sheet is shown in orange and black, with text
the ubuntu chat sheet is shown in orange and black, with text
an image of a computer screen with the text art index of the bash command line for linux
an image of a computer screen with the text art index of the bash command line for linux
the linux table's spreadsheet is shown in this screenshote image
the linux table's spreadsheet is shown in this screenshote image
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.

AD

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!

AD