Skip to content

Instantly share code, notes, and snippets.

@LaloHao
Last active February 28, 2021 01:45
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 LaloHao/a6ed0614671d0fda1aa5378e04a2cefd to your computer and use it in GitHub Desktop.
Save LaloHao/a6ed0614671d0fda1aa5378e04a2cefd to your computer and use it in GitHub Desktop.
Generate N password(s), each one having X alphanumeric length
# Generate 10 passwords, each one having 80 alphanumeric characters
X=80 N=10; cat /dev/urandom | tr -dcs '[:alnum:]' - | fold -w "$X" | head -n "$N"
# Generate 10 passwords, each one having 80 alphanumeric characters with at least one of the symbols in '!$%@^&*'
X=80 N=10; cat /dev/urandom | tr -dcs '[:alnum:]!$%@^&*' - | fold -w "$X" | grep '\(!\|$\|#\|%\|@\|^\|&\|*\)' | head -n "$N"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment