One liner:

pass=`cat /dev/urandom | head -2 | tr -cd 'a-zA-Z0-9!@#$%^&*()_+-=][';/.,'`; echo ${pass:4:30}

function in .bashrc:

pass(){
    password=`cat /dev/urandom | head -2 | tr -cd 'a-zA-Z0-9!@#$%^&*()_+-=][';/.,'`;
    echo ${password:4:30}
}

Continue reading