Tuesday, 10 June 2014

SHELL: Generate a random string


# bash generate random 32 character alphanumeric string (upper and lowercase)

STRING=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)

Source