-
-
Save praisegeek/aad1e066ae2dc70717e6f540a451f2b6 to your computer and use it in GitHub Desktop.
OSX Generate Random String
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
openssl rand -base64 6 | |
openssl rand -hex 4 | |
openssl rand -base64 8 | md5 | head -c8;echo | |
openssl rand -base64 6 | |
ping -c 1 yahoo.com |md5 | head -c8; echo | |
env LC_CTYPE=C tr -dc "a-zA-Z0-9-_\$\?" < /dev/urandom | head -c 10 | |
cat /dev/urandom | env LC_CTYPE=C tr -dc a-zA-Z0-9 | head -c 16; echo | |
Generate random password on Mac OS X | |
Feel free to put this in your ~/.profile: | |
random(){ cat /dev/urandom | env LC_CTYPE=C tr -dc $1 | head -c $2; echo; } | |
Then use it to generate passwords: | |
random [:alnum:] 16 | |
Or DNA sequences: | |
random ACGT 256 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment