Tech Informant

How to create and read QR/Barcode in Linux Terminal

A machine-readable code consisting of an array of black and white squares, typically used for storing URLs or other information for reading by the camera on a smartphone.

To install Barcode

The barcode program is a front-end to access some features of the library from the command line.  It is able to read user-supplied strings from the command line or a data file (standard input by default) and encode all of them.

1- Install epel repository



2- Install packages



 3- Create standard bar code

                   # barcode –b “This is my first barcode” –o
                   # ls

 4- Display the barcode

                   # display


 To Install QR code

QR, stands for ‘Quick Response’ are the types of hyperlinks that can be physically distributed and users can easily access the url/text that is behind that QR Code. The QR code can encode upto 4,296 characters.

1-  Install epel repository



 2- Install packages


 3- Create and display QR Code

                   # qrencode -b “Hi This is my 2d code.” -o 2d.png

                    # display 2d.png



Decode a QR code on the command line we can use the package zbar

 zbarimg – scan and decode bar codes from image file(s)

1- Install Package



 2- To decode the hello.png QR we created above

            # zbarimg 2d.png
                        QR-Code:Hi This is my 2d code.
                         scanned 1 barcode symbols from 1 images in 0 seconds


Thus we can see that the QR-Code has been correctly showing the output.


Difference between QR code and Barcode



QR Code



Commercial origin

In the year 1994

In the year 1974


Matrix type



Represented by

Square dots on a square grid

Vertical arrangement of parallel lines


Storing and transmitting text, images, contacts, music, etc.

Storing and transmitting data associated with consumers, or consumer products.

Mainly used in

Smart phones, tablet devices, computers, etc.

Supermarkets, hospitals, cinema theatres, express mails, etc.

 More Info-