Skip to content

Instantly share code, notes, and snippets.

@clementi
Last active May 10, 2019 16:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save clementi/6248d2181154c985149b9a78b8676148 to your computer and use it in GitHub Desktop.
Save clementi/6248d2181154c985149b9a78b8676148 to your computer and use it in GitHub Desktop.
Generate random string from /dev/urandom
function pwgen() {
head -c 1024 /dev/urandom \
| LC_CTYPE=C tr -dc 'a-zA-Z0-9~!@#$%^&*_-/\\(){}[]:;<>\?\+=|.,"' \
| fold -w ${1:-20} \
| head -n 1;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment