Generate Secure Password


Install on macOS

$ brew install pwgen

Add this function to .bashrc or .zshrc:

function pwdgen() {
  pwgen -Bs $1 1 | pbcopy | pbpaste | echo "Copied to clipboard!"

Source your .bashrc or .zshrc:

source ~/.zshrc

To generate a 8-char password:

$ pwdgen 8
Copied to clipboard!

To configure your generated password, see pwgen(1) man page:

$ man pwgen

Then edit the function in your shell startup file accordingly.


Please refer to 1Password's offical download page for all platforms:

1Password Download Page

Linux you can use alternative software like:

Secure your password!

Share this post