Skip to content

tr

generate random password using tr

< /dev/urandom tr -dc [:alnum:] | head -c 10 ; echo

Tip

can be added as a function into your ~/.bashrc file

function rp (){
    for count in ${@}; do
        < /dev/urandom tr -dc [:alnum:] | head -c $count ; echo
    done
}
sample output
$ rp 10 15 20 25
8yPchDowO5
QwJwjOWPxvIfIOa
xHA2kW9CygvrjvgilFzM
Eh3uw5p9yfGQXstni114tCX9R

generate strong random password using tr

< /dev/urandom tr -dc [:alnum:][:punct:] | head -c 16 ; echo

Tip

can be added as a function into your ~/.bashrc file

function srp (){
    for count in ${@}; do
        < /dev/urandom tr -dc [:alnum:][:punct:] | head -c $count ; echo
    done
}
sample output
$ srp 10 15 20 25
jn>e!pA#U$
clU;\:}=l&n>N<'
<o|kWNEI-V,O'E`[k+>n
.+q$<8qN^Q{<$g:HMuhQW]Jc: