Files and folders

Make a QR code from a link

Turn any link or text into a QR code picture from the terminal, then scan it back to check it works.

Fill these in once
  1. Install qrencode
    Terminal
    brew install qrencode
  2. Make the QR code picture
    Terminal
    qrencode -o qr.png -s 10 "https://example.com"

    -s 10 makes each square 10 pixels, big enough to print. Use a bigger number for posters.

  3. Or show it right in the terminal
    Terminal
    qrencode -t ansiutf8 "https://example.com"

    Handy for scanning straight off the screen with your phone.

  4. Make one that joins your Wi-Fi
    Terminal
    qrencode -o wifi.png -s 10 "WIFI:T:WPA;S:MyNetwork;P:MyPassword;;"

    Replace MyNetwork and MyPassword. Phones offer to join the network when they scan it.

Check it worked

  1. Open the picture
    Terminal
    open qr.png

    Point your phone camera at it. It should offer to open the link.

  2. Or read it back in the terminal
    Terminal
    brew install zbar && zbarimg qr.png

    Prints what the code says, like QR-Code:https://example.com.

Undo it
  1. Delete the picture
    Terminal
    rm qr.png
  1. Install qrencode (Ubuntu and Debian)
    Terminal · Ubuntu / Debian
    sudo apt install qrencode

    Fedora: sudo dnf install qrencode.

  2. Make the QR code picture
    Terminal · Ubuntu / Debian
    qrencode -o qr.png -s 10 "https://example.com"

    -s 10 makes each square 10 pixels, big enough to print. Use a bigger number for posters.

  3. Or show it right in the terminal
    Terminal · Ubuntu / Debian
    qrencode -t ansiutf8 "https://example.com"

    Handy for scanning straight off the screen with your phone.

  4. Make one that joins your Wi-Fi
    Terminal · Ubuntu / Debian
    qrencode -o wifi.png -s 10 "WIFI:T:WPA;S:MyNetwork;P:MyPassword;;"

    Replace MyNetwork and MyPassword. Phones offer to join the network when they scan it.

Check it worked

  1. Open the picture
    Terminal · Ubuntu / Debian
    xdg-open qr.png

    Point your phone camera at it. It should offer to open the link.

  2. Or read it back in the terminal
    Terminal · Ubuntu / Debian
    sudo apt install zbar-tools && zbarimg qr.png

    Prints what the code says, like QR-Code:https://example.com.

Undo it
  1. Delete the picture
    Terminal · Ubuntu / Debian
    rm qr.png
  1. Install the qrcode tool with Python
    PowerShell
    pip install "qrcode[pil]"

    Needs Python. If pip isn't found, install Python first.

  2. Make the QR code picture
    PowerShell
    qr --output qr.png "https://example.com"
  3. Or show it right in the terminal
    PowerShell
    qr "https://example.com"

    Handy for scanning straight off the screen with your phone.

  4. Make one that joins your Wi-Fi
    PowerShell
    qr --output wifi.png "WIFI:T:WPA;S:MyNetwork;P:MyPassword;;"

    Replace MyNetwork and MyPassword. Phones offer to join the network when they scan it.

Check it worked

  1. Open the picture
    PowerShell
    start qr.png

    Point your phone camera at it. It should offer to open the link.

Undo it
  1. Delete the picture
    PowerShell
    del qr.png

New to QR code? I explain it in plain English on Layman Terms.