DEV Community

Cover image for How to Find Your WiFi Password and Share It With Others Through a QR Code in Bash!
Code_Jedi
Code_Jedi

Posted on

How to Find Your WiFi Password and Share It With Others Through a QR Code in Bash!

Did you ever forget your WiFi password? Or did you ever have guests over and needed an easy way to share your WiFi?
Well in this mini-tutorial, I'll show how you can easily find your WiFi password and share it with others through a QR code using a command-line tool.

Installing the Tool

The tool that is going to allow you to do this needs to be installed through NPM so make sure you have NPM installed. You can use this guide for installing NPM.

Once you have NPM installed, install the wifi-password-cli module using:

npm install --global wifi-password-cli
Enter fullscreen mode Exit fullscreen mode

Using the Tool

Now that you have the module installed, use the following to see its usage:

wifi-password --help
Enter fullscreen mode Exit fullscreen mode

You will see the following output:

usage: wifi-password [options]

optional arguments:
  -h, --help            show this help message and exit
  --show-qr, -show      Show a ASCII QR code onto the terminal/console
  --save-qr [PATH], -save [PATH]
                        Create the QR code and save it as an image
  --ssid SSID, -s SSID  Specify a SSID that you have previously connected to
  --version             Show version number
Enter fullscreen mode Exit fullscreen mode

You can simply display your WiFi password through the terminal using:

wifi-password
Enter fullscreen mode Exit fullscreen mode

This will prompt you with a security sudo user confirmation window:
Security prompt

I have a macOS, but you will see a different prompt depending on your OS. Enter the required information and your WiFi password will be displayed in terminal!

You can use the following command to generate and display a QR code of your WiFi password for guests to scan:

wifi-password --show-qr
Enter fullscreen mode Exit fullscreen mode

You can save this QR code as an image using the following command:

wifi-password --save-qr [PATH]
Enter fullscreen mode Exit fullscreen mode

You can choose where to save the image by varying the path argument at the end, for example:

wifi-password --save-qr /usr/local/images
Enter fullscreen mode Exit fullscreen mode

Conclusion

I hope this will come in helpful ;)

Top comments (0)