Random password generation

From V.S.V., Inc.
Jump to: navigation, search

There are many reasons for needing a new password. Once you have the password you can copy it to a web browser or pipe it to passwd or some other app.

The basic command is:

( < /dev/urandom tr -dc <characters in password> |head -c${1:-<length of password>};echo;)

Examples:

( < /dev/urandom tr -dc _A-Z-a-z-0-9'!@#$%' |head -c${1:-15};echo;)

Or

( < /dev/urandom tr -dc _A-Z-a-z-0-9'!@#$%' |head -c${1:-15};echo;) | tee /tmp/$$ | passwd --stdin <USER>