BASH create random password

apg -MSNCL  -m8 -x11 -n10 -E\%\\\/\|\`\<\>\+\{\}\”\’

or

< /dev/urandom tr -dc A-Za-z0-9_$*?! | head -c10

Another useful implementation thanks to www.cyberciti.biz, a sample random password generator (put in your ~/.bashrc):
genpasswd() {
local l=$1
[ "$l" == "" ] && l=20
tr -dc A-Za-z0-9_ < /dev/urandom | head -c ${l} | xargs }

Run it:
genpasswd 16
Output:
uw8CnDVMwC6vOKgW

You can leave a response, or trackback from your own site.

Leave a Reply