Skip to content

Instantly share code, notes, and snippets.

@dathanb
Created March 24, 2022 22:11
Show Gist options
  • Save dathanb/73c652b4a1f9eda3bd12c148709c8e77 to your computer and use it in GitHub Desktop.
Save dathanb/73c652b4a1f9eda3bd12c148709c8e77 to your computer and use it in GitHub Desktop.
Generate a random password from the command line
length=40
forbiddenChars="+*/^"
openssl rand 4096 | \
LC_ALL=C tr -cd '[:alnum:][:punct:]' | \
tr -d "${forbiddenChars}" | \
fold -w "${length}" | \
head -n 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment