Created
May 26, 2020 10:22
-
-
Save ksaver/43010062708bae3effbd5a91ac533d23 to your computer and use it in GitHub Desktop.
Generate random passwords from bash command line.
This file contains hidden or 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
# Generate random passwords from bash command line. | |
function random_passwd() { | |
LENGHT=${1:-16} | |
cat /dev/urandom |tr -dc 'A-Za-z0-9@#$%&()=-_?!+*{[]}' \ | |
| fold -w $LENGHT \ | |
| head -n 3 # shows 3 passwords | |
echo | |
} | |
random_passwd 24 # 24 characters long password | |
random_passwd # default 16 chars long |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment