I have installed Bluetooth dongle software and with the help of commands (using a terminal), I want to send and receive files from a smartphone.
How can I pair my devices and send files over Bluetooth using Terminal?
03 Answers
Send files:
bluetooth-sendto --device=12:34:56:78:9A:BC filenameTo know your device name (12:34:56:78:9A:BC), you can issue this command:
hcitool scanReceive files:
Haven't found it yet, but will let you know if it can be done using terminal
edit:
it looks like it can't be done through terminal. Blueman seems to do the trick but it's in GUI
1I tested this with Ubuntu Bionic Beaver (18.04) and Android Lollipop.
Ubuntu. Install the needed packages:
sudo apt install bluez bluez-toolsbluez-tools come with the following tools:
bt-adapterbt-agentbt-devicebt-networkUbuntu. Turn on the visibility:
bt-adapter --set Discoverable 1Smartphone. Scan for remote devices to ID your Ubuntu machine.
Ubuntu. Prep for managing incoming requests interactively with:
bt-agentPair devices:
Smartphone. Initiate pairing request;
Ubuntu. Accept the request from the bt-agent screen.
Ubuntu. Send files to smartphone with:
bt-obex -p [remote_mac] [file]where [remote_mac] is the mac address of the smartphone. For example:
bt-obex -p F0:6B:CA:A2:C4:69 ~/book.pdfReceive files from your smartphone:
Ubuntu First create a Bluetooth file (obex) server:
bt-obex -s [path][path] is where to download files. For example:
bt-obex -s ~/DownloadsSmartphone. Send the file;
- Ubuntu. Accept the request from the bt-agent screen.
This works on my computer:
bluedevil-sendfile -u /org/bluez/hci0/dev_<address with underscores instead of colons> -f <file_with_absolute_path>For example:
bluedevil-sendfile -u /org/bluez/hci0/dev_00_FF_00_FF_00_FF -f /home/tux/test.pdf