Enabling Bluetooth Service

To enable any service at start-up, we execute the systemctl enable command. 

$ sudo systemctl enable --now bluetooth.service
  • sudo allows the user to run commands with the privileges of a superuser.
  • enable command enables the mentioned service at boot.
  • — now flag starts the mentioned service right away.

 

Now we can check the status of the service using the systemctl status command. It returns the activity status of the mentioned service.

$ sudo systemctl status bluetooth.service

 

Sometimes, the Bluetooth service may be blocked and to unblock it we need to execute the following command.

rfkill is a tool for enabling and disabling wireless devices

$ rfkill

 

In case it is soft-blocked, execute the following command to unblock

$ rfkill unblock bluetooth

You can run the rfkill command to check the status of Bluetooth.

 

Connecting To Bluetooth Devices Via CLI

The Bluetooth wireless technology is a worldwide specification for a small-form-factor, low-cost radio solution that provides links between mobile computers, mobile phones, and other portable handheld devices. You’ll find Bluetooth connectivity in smartphones, smartwatches, wireless earphones, etc. 
In this article, we’ll be learning how to connect to a Bluetooth Device via CLI on Linux. 

Similar Reads

What Is BlueZ?

BlueZ is the official Bluetooth protocol stack for Linux distributed under GNU General Public License (GPL) that provides support for the core Bluetooth layers and protocols. It is flexible, efficient, and uses a modular implementation. It has many interesting features:...

BlueZ Installation

Depending on your distro type, run one of the below commands to install BlueZ and other related tools....

Adding User to Required Group

By default, the Bluetooth daemon will only give out Bluetooth devices to users that are a member of the lp group. We need to make sure to add our current user to the lp group to connect to a Bluetooth tether....

Enabling Bluetooth Service

To enable any service at start-up, we execute the systemctl enable command....

Triggering the utility tool

We will be using a utility tool called bluetoothctl that allows various tasks like pairing and connecting a Bluetooth device. To start this utility, just type bluetoothctl in CLI....

Scan for nearby devices

Before connecting to any device, we need to scan for all nearby available devices using the command below.scan on command will actively scan all discoverable Bluetooth devices around the user....

Pairing a device

In order to form a connection, a Bluetooth device needs to be paired with another Bluetooth device. Enter pair [ID] where [ID]  is the unique Bluetooth device identifier shown in the above command....

Contact Us