Bash/Misc/Random string
Aus SchnallIchNet
< Bash
Version vom 3. Mai 2011, 13:40 Uhr von Cbs (Diskussion | Beiträge) (Die Seite wurde neu angelegt: „== generate a random string == l=20 tr -dc A-Za-z0-9_ < /dev/urandom | head -c ${l} | xargs echo this generates a 20 bytes log pseudo(!!)-random string. <br/>…“)
generate a random string
l=20 tr -dc A-Za-z0-9_ < /dev/urandom | head -c ${l} | xargs echo
this generates a 20 bytes log pseudo(!!)-random string.
this will help you to generate more or less secure passwords
if included in bashrc as a function you may use it as a command in bash:
genpasswd() { local l=$1 [ "$l" == "" ] && l=20 tr -dc A-Za-z0-9_ < /dev/urandom | head -c ${l} | xargs }