QR Codes at the command line

QR Codes at the command line

QR code generation at the command line

QR codes are nothing new, but have you ever thought about creating your own from the command line? Someone had that idea before me and created the code to make it happen. The nice thing about making your own QR codes is that the information stays just on your computer, unlike using a website to do the work for you and not knowing who is collecting it.

Installing the code

“qrencode” is a versatile, fast, and richly-featured QR code generator that is executed at the command line.

To install qrencode on Ubuntu, we type this:

To install qrencode on Fedora, use this command:

Using qrencode

As with all commands in Linux – read the man page. There are a lot of options and tricks that you will pick up when you read the instructions.

Here are a couple of examples:

Making a QR code with your website address –

This will produce a QR code png with your website address ready to be scanned.

QR Code for your “Guest” Wi-Fi

It’s possible to encode the details of a Wi-Fi network in a QR code. Visitors can scan the QR code to easily connect to your guest Wi-Fi.

The keyword is Wi-Fi, followed by a colon ” : ” and several other parameters.

  • T: The type of security. This can be WPA2 or WPA3. Note there is a colon between the “T” and the security value, and there is a semicolon ” ; ” after the security setting.
  • S: The Service Set ID (SSID) of the Wi-Fi network. Note there is a colon between the “S” and the SSID, and there is a semicolon ” ; ” after the SSID.
  • P: The password or security key of the Wi-Fi network. Note there is a colon between the “P” and the security key, and are two semicolons ” ;; ” after the security key.

QR Code contact

Contact details in the vCard format can be added to a QR code and scanned into the user’s address book. This removes the risk of mistyping something. There’s a lot of information that can be stored, so it is best to add the details to a file and to redirect that file into qrencode.

This text was added to a file called “contact_info.txt”

We can redirect this file into qrencode like this:

Conclusion

I love using the command line for most things (I am a control freek and I admit it). Having the ability to make my own QR codes for things is handy for a lot of things. A couple examples of what I did are: First, I made a framed QR code for people I have over because I am always asked “what is the password to your Wi-Fi”. I can just point to the picture, and they can get onto my guest network.  Second, I created a business card with my VCard information in it, so people can scan it and add me to their address book.

Your imagination is the only thing holding you back. Try things with the code and create your own QR codes for things. Now you can do it right from the command prompt!

How useful was this post?

Click on a star to rate it!

Average rating 5 / 5. Vote count: 2

No votes so far! Be the first to rate this post.


Leave a Reply

Your email address will not be published. Required fields are marked *


Updated on June 18, 2023

Pixelated Dwarf