1. Overview
Bluetooth technology has become an integral part of modern computing, providing a convenient and wireless way to connect and exchange data between devices. In the Linux ecosystem, transferring files via Bluetooth is seamless, allowing users to share documents, photos, and other files effortlessly.
In this tutorial, we’ll explore transferring files via Bluetooth in a Linux environment.
2. What Is Bluetooth?
Bluetooth is a wireless technology that facilitates smooth connections and data transmission between devices over short distances without the use of cables. It is commonly used for file transfer, audio streaming, and connecting peripherals like keyboards, mice, and headphones.
3. Checking the Status of Bluetooth Service in Linux
Before diving into transferring files via Bluetooth, let’s first open the terminal and check the status of Bluetooth on our Linux system using systemctl:
$ sudo systemctl status bluetooth.service
● bluetooth.service - Bluetooth service
Loaded: loaded (/usr/lib/systemd/system/bluetooth.service; enabled; preset: disabled)
Active: active (running) since Mon 2024-01-15 18:02:31 +0545; 6s ago
Docs: man:bluetoothd(8)
Main PID: 8009 (bluetoothd)
Status: "Running"
...
The above command output indicates that the Bluetooth service is enabled and actively running. If the Bluetooth service is not active, we can start it using systemctl:
$ sudo systemctl start bluetooth.service
4. Connecting Bluetooth Devices
To connect the Bluetooth device, we’ll open the Bluetooth manager and click on the search tab to discover nearby Bluetooth devices. These menus may look a little different depending on our current operating system:
Similarly, once the Bluetooth device is found, we can pair the device. For this, let’s double-click on the identified target Bluetooth device (in this case, Galaxy A52), and then confirm the pair request on both devices (on our Linux system and Galaxy A52):
We must take note of the MAC Address of the Galaxy A52 (A2:7S:1B:46:F4:E0) as we will use it later to transfer files from the Linux system.
5. Transferring Files via Bluetooth Using the CLI Method
Linux provides several CLI (Command-Line Interface) tools for Bluetooth file transfer, with bluetooth-sendto and bt-obex being two common options.
5.1. Using bluetooth-sendto
bluetooth-sendto is a command-line utility that is part of the GNOME Bluetooth package. It provides a simple way to send files over Bluetooth.
After successfully pairing our Linux system with the target device, we can start transferring files. Let’s install bluetooth-sendto using apt-get:
$ sudo apt-get update
$ sudo apt-get install gnome-bluetooth-sendto
Once we’ve installed the gnome-bluetooth-sendto package, we’ll open a terminal and run the bluetooth-sendto command, specifing the target device’s MAC Address and the file we want to transfer from our Linux system:
$ bluetooth-sendto --device=A2:7S:1B:46:F4:E0 /home/user/Desktop/Testdirectory/file-3.txt
Upon executing the above command, we’ll need to accept the file transfer request on the target device (Galaxy A52) so that the file transfer from the Linux system to our target device is successful.
5.2. Using bt-obex
Another CLI method to transfer files over Bluetooth in a Linux environment is bt-obex. It often comes bundled with desktop environments that provide Bluetooth support, such as GNOME or KDE.
To use bt-obex, we need to install the bluez bluez-tools package:
$ sudo apt-get update
$ sudo apt-get install bluez bluez-tools
Similar to the bluetooth-sendto command, we’ll try to send a file named file-3.txt located in our /home/Desktop/Testdirectory directory using bt-obex along with the -p option, which makes it send the file to a remote device*:*
$ bt-obex -p A2:7S:1B:46:F4:E0 /home/user/Desktop/Testdirectory/file-3.txt
The file transfer can only be successful once we accept the file transfer request on both the sender and receiver devices.
6. Transferring Files via Bluetooth Using the GUI Method
While the Linux CLI provides a powerful environment designed for advanced users, not everyone is comfortable with going through its complex commands, therefore, for those preferring the GUI (Graphical User Interface) method, transferring the files using a GUI can be an easy option.
First, let’s go to the directory where file-3.txt is located. Upon right-clicking the file, we can find the Send To option, and then select to send the file via Bluetooth Device:
Once we select to send the file via Bluetooth Device, it prompts us to select the target device, which in this case is our Galaxy A52:
7. Receiving Files via Bluetooth in Linux
Receiving files in Linux is also as easy as sending files. For this, we need to be paired on both devices, select the file we want to send, and then send the file via Bluetooth from our device to the receiver Linux system:
We must accept the transfer request on our receiver device to receive the file successfully.
8. Conclusion
In this article, we explored both the CLI and GUI methods for transferring files via Bluetooth in Linux.
Whether we prefer utilizing CLI tools like bluetooth-sendto and bt-obex, or intuitive GUI interactions, Linux users can seamlessly exchange files with their devices over Bluetooth, enhancing the overall convenience and versatility of their computing experience.