How to set up bluetooth (the hackerman way)

Last edited: 25th April 2026

A very basic problem: I have some wireless headphones, which also can be optionally wired, however, I want to connect them via bluetooth instead. When using a desktop environment, this is not an obstacle, but I do not use one, and if you use a window manager like me, you have to resort to an external application, and when especially using a tiling window manager, it is gonna be a terminal application, and the best way of learning something rather complicated like a terminal application is by teaching it to others, so this is a very simple guide on how to set up bluetooth via the command line (or the spooky hackerman stuff).

First of all, installing the package. Install the bluez and maybe the bluez-utils package via the system's package manager. As for audio, this requires also to either install bluez-alsa for ALSA users, pulseaudio-bluetooth for PulseAudio users (sometimes this is not needed), or libspa-bluetooth (sometimes this is not needed) or pipewire-audio for PipeWire users.

Next, enable the bluetooth daemon, and add your local account to the bluetooth group (if needed; sometimes you do not have to be in this group):

# usermod -aG bluetooth <user>

Sometimes, the Linux kernel soft blocks the bluetooth card, so make sure that the output of the command rfkill list does not display that bluetooth is soft blocked. If it does display that it is blocked, run the command:

# rfkill unblock bluetooth

Now reboot your system.

After rebooting, type in the command:

$ bluetoothctl

This is just a front-end for bluez, which is invoked in a command line user interface shell, noticeable by the shell's prompt normally looking like this:

[bluetoothctl]#

So now start scanning for devices with the subsequent command:

[bluetoothctl]# scan on

This will display all the junk devices running bluetooth near you. What you see printed out is the MAC address and the device name. Pair with the device that you want to connect:

[bluetoothctl]# pair <mac_address>

Sadly, you can only connect via typing the MAC address. A quick way of doing that is by pressing a few characters of the MAC address and then pressing tab to autocomplete the MAC address.

IMPORTANT: Some bluetooth devices may also need to connect after pairing:

[bluetoothctl]# connect <mac_address>

Now the device should be connected. Because it is just a daemon that is running in the background, you can close the entire terminal window, and your bluetooth device will be still connected. You can also leave the terminal window open if you are a weirdo. If you do that, you probably do not need the scanning to still go on, so turn it off:

[bluetoothctl]# scan off

Another thing you might want to do is to automatically connect the device again later on, which requires you to trust the bluetooth device:

[bluetoothctl]# trust <mac_address>

When shutting down the bluetooth device and then power it on again, it will automatically connect without manually reconnecting the device. This might not work well enough when not restarting the system.

As for shutting down the connected bluetooth device, type:

<device_name># disconnect <mac_address>

If you also want to forget the device, type the command:

[bluetoothctl]# remove <mac_address>

Lastly, to never pair it again, type:

[bluetoothctl]# untrust <mac_address>

That is it! That was quite simple!