Generate Random Passwords on the Linux Command Line
Here is a quick one line command to generate a random password from the Linux command line.
# < /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c8
This will create an 8 character long password. To make it longer or shorter change c8 to c# (# being whatever number you want).
Another way to go about this is the pwgen command. Simply install pwgen and execute it and it will give you a bunch of random passwords, simply pick one out of the bunch.








Great tip. Depending on your requirements, a better command line might be
head -c8 /dev/random | uuencode -m – | sed -n ‘2s/=*$//;2p’
since this also includes special characters.