sebastiandaschner blog


Transferring Data With QR Codes on the Linux Command Line

#linux #commandline tuesday, january 14, 2025

When transferring small amounts of data, such as a long URLs, public/private keys, or similar from one computer to another, people often end up pasting the contents in some sort of online notepad or email draft. It’s also possible to quickly create and read QR codes, from the Linux command line. For this, the computers don’t even have to be online, and in any way it’s better for your privacy.

I use the tools qrencode and zbar-tools:

$> qrencode -o /tmp/hello.png "Hello world 😎"

$> zbarimg /tmp/hello.png
QR-Code:Hello world 😎
scanned 1 barcode symbols from 1 images in 0 seconds

To transfer the data, view the image on the first computer and use zbarcam on the second and point it’s webcam to the QR code:

# on the second machine (will start your webcam)
$> zbarcam
QR-Code:Hello world 😎

# or if you have multiple webcams
$> zbarcam /dev/video1

 

Found the post useful? Then you might enjoy my other command line posts.