Skip to content

Instantly share code, notes, and snippets.

@viktorbenei
Last active March 19, 2018 09:39
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save viktorbenei/cca967e09bf701aa9cb5 to your computer and use it in GitHub Desktop.
Save viktorbenei/cca967e09bf701aa9cb5 to your computer and use it in GitHub Desktop.
Bash script to generate secure passwords
#
# requires 'pwgen', can be installed with brew
#
# add this to your .bash_profile, .profile or .bashrc for quick terminal access
# input: the length of the password
# usage example: gensecpsw 16
# example result: XjQ%uWQ.&7-T4@`(
#
gensecpsw() {
printf '%s' $(pwgen -B -c -s -n -y $1 1) |pbcopy; echo "Has been copied to clipboard"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment