How do you output a QR code to the linux cli terminal for scanning?
Solution 1
Use the terminal application 'qrencode'. The command you are looking for is the following:
qrencode -t ansiutf8 < myfile_here
The t option is to specify output type. it can also be PNG for a file or ASCII as ascii format.
Solution 2
Passing an url inline:
qrencode -m 2 -t utf8 <<< "https://superuser.com/questions/1492624/how-do-you-output-a-qr-code-to-the-linux-cli-terminal-for-scanning/1492625"
To ease the use, with an alias:
alias qr='qrencode -m 2 -t utf8 <<< "$1"'
The first time:
. ~/.bashrc
Now, later on, possible usages:
qr https://superuser.com/questions/1492624/how-do-you-output-a-qr-code-to-the-linux-cli-terminal-for-scanning/1492625
qr "Hello world!"
qr $(cat file.txt)
.
Related videos on Youtube
Patoshi パトシ
MIT graduate developer living and working from Tokyo! (◠‿◠) Open to freelance opportunities in Crypto or Drupal. Supporting: https://girlswhocode.com https://www.liftcommunities.org https://www.pursuit.org https://www.womenwhocode.com
Updated on September 18, 2022Comments
-
Patoshi パトシ over 1 year
I want to be able to output a QR code to the ubuntu cli terminal where I can scan with my phone. I have a configuration file I want to convert to a QR code so I can scan it vs having to transfer it over a usb drive. Many of the google results only show you how to convert a file to a QR image file, but I want to output to the terminal itself.
-
Hannu about 3 years
sudo apt install qrencode