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.

3 Answers 3


Use the terminal application qrencode (man page). 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.

  • 2
    sudo apt install qrencode
    – Hannu
    Apr 18, 2021 at 8:48
  • `echo "this a string" | qrencode -t ansiutf8
    – Madacol
    Sep 23, 2023 at 11:12

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)



If you are looking for a python library, look at this GitHub project qrcodeT.

Install qrcodeT simply using:

pip install qrcodeT

Example usage:

import qrcodeT

Sample result: sample output

  • Question doesn't ask python solution.
    – Toto
    Aug 9, 2022 at 10:08
  • 2
    @Toto, it doesn't exclude it either, right? It says "...to output a QR code to the ubuntu cli terminal..." and the usage section actually shows an example of how to use this on the command line. It's cumbersome, sure, but it does answer the question. Aug 9, 2022 at 10:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .