Last active
December 19, 2020 02:52
-
-
Save wdzajicek/4b9d5f50af67fa6d3c4ebbf6c4298129 to your computer and use it in GitHub Desktop.
Terminal random password generator
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Create a random string of characters that are safe for passwords | |
## Terminal random password generator | |
## The "translate characters" (`tr`) command didn't work on my Mac without prepending with `LC_ALL=C` | |
LC_ALL=C tr -dc 'A-Za-z0-9!"#$%&'\''()*+,-./:;<=>?@[\]^_`{|}~' </dev/urandom | head -c 13 ; echo | |
## Change the length of the outputed string by adjusting the number at the end of the command: `| head -c 13 ; echo` | |
## The line of code above will generate a random string that is 13 characters long. | |
## 16 chars would end with: `| head -c 16 ; echo` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment