How to generate a random password from command line

By | January 27, 2014

Password

One of the most annoying things you need to handle sometimes is password change. Of course, you need to pick a good one, not just “blue123”.

Sure, there are many websites that can generate a random number or string for you such as random.org, but did you know you can do it very simply from command line?

You just need to use the tr command to reach from /dev/urandom .. so it is pretty random:

tr -dc _A-Z-a-z-0-9  < /dev/urandom  | head -c10

If you need to change the password length, you just need to change the -c parameter. Also, you can change the characters to be included pretty easily with the -d parameter.

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload the CAPTCHA.

This site uses Akismet to reduce spam. Learn how your comment data is processed.