How to quickly send a text from Ubuntu to Android using a three-line Bash script

Transferring text from Ubuntu to Android using a Bash script is a powerful and efficient way to automate the process of transferring text between devices. Bash scripts are a powerful tool that can be used to automate repetitive tasks, and can be used to create simple and complex programs.

In the case of transferring text from Ubuntu to Android, a Bash script can be used to automate the process of copying text on one device and pasting it on the other.

In this short article, you will be able to send a short text from Ubuntu to your Android device very easily.

On your Ubuntu machine, open your terminal and create the following script file :


# Check if the qrencode package is already installed
if ! command -v qrencode > /dev/null; then
echo “qrencode package is not installed. Installing…”
sudo apt-get install qrencode
# Input the text to be encoded
echo “Enter the text to be encoded:”
read text
# Create a QR code image containing the text
qrencode -o qr.png “$text”
# Share the QR code image to the Android device
xdg-open qr.png

This script first checks if the “qrencode” package is already installed, and if not, it installs it. Then, it prompts the user to enter the text to be encoded, and uses the “qrencode” command to create a QR code image named “qr.png” containing the text. Finally, it uses the “xdg-open” command to open the QR code image in the default image viewer, which should then allow you to share

the image to the Android device.

In order to check the script above, you can execute each command in the terminal as follows : After having installed qrencode, execute the following command :

Read: How to tweet from the Linux Command Line

Then run the command :

qrencode -o qr.png “hey net2”

You will see below that the file qr.png has been created :

And finally, invoke the command:

xdg-open qr.png

Read: How to send one-liner emails from Linux/Ubuntu terminal – Embed email sending feature into your application

You will then be able to scan the code that pops up on your Android device. You should finally see the text popping up on your screen.

If you like the content, we would appreciate your support by buying us a coffee. Thank you so much for your visit and support.


Marianne elanotta

As a graduate in communication technologies, Marianne likes to share the latest technological advances in various fields. She likes to program in Java OO and Javascript and prefers to work on Open source operating systems. She likes to play chess and computer games in her spare time along with her 2 kids.

Leave a Reply