Ubuntu

How to Send files from Ubuntu to a Bluetooth device

Bluetooth is a wireless technology standard that is used for data transferring between devices within the short-range, usually less than 5 meters. It is a trusted and popular file transferring method, that allows connecting devices such as laptops, smartphones, mouse, keyboard, tablets, etc.

In this article, we will learn how to send files from Ubuntu to a Bluetooth device through the GUI and the command line. We will also explain how to install the Bluez Bluetooth stack for Linux in your system. It is a necessary package that is required in order to use the Bluetooth in Linux.

Sending files through GUI

To install Bluez in your Ubuntu system, you will need to open Software Center. Hit the super key and select the Software Center from the Dock panel.

In the Software Center, type bluez in the search bar and hit Enter. When the search result appears, select the Bluez application. Start the installation by clicking the Install button.

At the start of installation process, a pop-up will appear asking you to enter the credentials for the authorized user. Provide the password for the authorized user and click Authenticate. Now, wait for a while until the installation of Bluez is completed and you see the following screen.

Now Bluetooth is ready to be used with your system.

Turn on Bluetooth

You can turn on Bluetooth in your system from the Setting utility. Hit the super key on your keyboard and search for the Settings utility using the search bar at the top of the Dash menu.

In the Settings utility, select the Bluetooth tab at the left panel. Under the Bluetooth tab, you will see the slider at the top of the window. Click on it to turn it to on position. It will enable the Bluetooth on your system.

Send files from Ubuntu to Bluetooth device

As soon as you enable Bluetooth, the system will start discovering the nearby devices which have Bluetooth enabled. When you find your desired device you want to send files to, select it to pair it with your system. By doing so, a pin will be displayed on your system as well as on your other Bluetooth device. You must ensure the pin on both devices is the same.

Then click the Confirm button on your system. Now both the system and your other Bluetooth device will be paired and the status of the device will be shown as connected.

Now you can start sharing files from your system to the connected Bluetooth device. To share files to the connected Bluetooth device, Select it to open the following dialog.

To send files to this device, click on Send Files button. After that, select the files you want to share over Bluetooth.

Once you are done, click the Select button and you will see the following Bluetooth file Transfer window displaying the progress of file transfer.

Sending files through Terminal

If you face any problem using Bluetooth via GUI, you can use the following command-line method. Using this method, you can send files from Ubuntu to a Bluetooth device via Ubuntu Terminal. To open the Terminal in your system, use the Ctrl+Alt+T shortcut.

First, install the Bluez utility in your system by running this command in your Terminal:

$ sudo apt install bluez

Turn on Bluetooth

To check if your Bluetooth is in on or off state, run this command:

$ sudo rfkill list

The soft block status in the output shows whether the Bluetooth is on or off. If the status is yes, Bluetooth is on, otherwise, it is off. If it is turned off, use the following command to turn it on:

$ sudo rfkill unblock bluetooth

Send files from Ubuntu to Bluetooth device

Now we will need to pair the Ubuntu to the external Bluetooth device. For that, we will use the bluetoothctl utility. Run the following command in terminal to start this utility:

$ bluetoothctl

Then run the following command in the Terminal to discover the nearby Bluetooth devices.

$ scan on

If the system discovers any Bluetooth device, it will list it in the Terminal. Note down the MAC address of the device you want to pair with.

Now in order to start pairing with a Bluetooth device, type pair followed by the MAC address of the Bluetooth device:

$ pair <Device-MAC>

Once you run this command, a pin will appear on the Terminal screen as well as on your other Bluetooth device. If the pin on both devices is the same, type yes. After which, your devices will be paired and you will see Pairing successful message.

To add your paired Bluetooth device as a trusted device, run this command: # trust <device-MAC>

Now you can start sharing files from your system to an external Bluetooth device. To share files, use the Settings utility following the same method as explained above in GUI method.

In this article, we have discussed how to send files from Ubuntu to a Bluetooth device using the GUI and command line methods. Either you use GUI or the Terminal, the process is simple: discover the device, pair with it and send files.

About the author

Karim Buzdar

Karim Buzdar holds a degree in telecommunication engineering and holds several sysadmin certifications. As an IT engineer and technical author, he writes for various web sites. He blogs at LinuxWays.