Last Updated: February 25, 2016
· diegen

Create random Password in Command Line

Following code yields a random password with 9 characters, alphanumeric, adjust the head -cN for different lengths

< /dev/urandom LC_CTYPE=C tr -dc A-Za-z0-9_ | head -c9

You could as well play with the regex to add some special characters to the mix.

< /dev/urandom LC_CTYPE=C tr -dc A-Za-z0-9_\*-\+ | head -c9