brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: qrencode draws a QR code right in your terminal for your phone

Tools
~/tips/tip-tools-qrencode-terminal-code

qrencode -t ANSIUTF8 'https://example.com/a/long/path?id=12345'

Move a link from a terminal session to your phone by scanning it.

I find typing a long URL from a server console into a phone no fun at all. qrencode can print the code as block characters, so you point the camera at the screen.

qrencode -t ANSIUTF8 'https://example.com/a/long/path?id=12345'

It works over SSH because it is all text, with no image file to copy around. For a picture you can print or paste into a document, write a PNG, which is the default format:

qrencode -o link.png -s 8 'https://example.com/'

-s sets the pixel size of each dot, with 3 as the default, so a larger number makes a bigger image. -l H raises the error correction level from the default L, useful for a printed label that may get scratched. You can also read the content from a file with -r.

Keep the text short when you can. The more data, the denser the code, and a dense one may not fit a small terminal window or scan well. Zoom out or widen the window if the camera struggles.

Also think about what you encode. Anyone who can see the screen can scan it, and a secret passed on the command line lands in your shell history. Install it from your package manager first; it is rarely there by default.

Further reading: qrencode man page

More Tools tips shuf -n 3 films.txt xmllint --format feed.xml pdftotext -layout invoice.pdf invoice.txt where python ffprobe -v error -show_entries format=duration -of default=nw=1:nk=1 input.mp4 All Tools tips (14) All topics

Link