Generate passwords from terminal

I often need a random password for yet another account on some website I will probably visit only once. In the past I used different online and/or offline tools or browser plugins to generate these random passwords but that required me to launch other applications and selecting various options over and over again to fill in my needs. Then I discovered an easy way to do exactly that through Terminal and immediately copy it to the clipboard as well. This has saved me a lot of time so you should add this line to your dotfiles:

##
# Random 14 character password generator using base64
##

alias passgen='openssl rand -base64 14 | pbcopy'

You can replace the number '14' in there by any number of characters you want the password to contain. The password will contain numbers, special characters and both uppercased and lowercased characters so when using this, you'll have a strong and pretty secure password.