Skip to content

Instantly share code, notes, and snippets.

@NF1198
Created February 24, 2017 21:59
Show Gist options
  • Save NF1198/b71ef58dc8ac3c288b447fbf1680b83a to your computer and use it in GitHub Desktop.
Save NF1198/b71ef58dc8ac3c288b447fbf1680b83a to your computer and use it in GitHub Desktop.
genpasswd
# add to bashrc
#genpasswd <num_chars>
# generates a password of the specified length
genpasswd() {
local l=$1
[ "$l" == "" ] && l=20
tr -dc [:alnum:]\*\&\^\%\$\#\@\_ < /dev/urandom | head -c ${l} | xargs
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment