Random Password

A quick little script to generate a random password. Nothing too fancy, but sometimes you just need a quick and dirty string to use for a new password.

Here’s how it works:

It first uses /dev/random to generate a random string and passes it to head, to limit the output. That is then passed to md5 to generate a string of alphanumeric characters. That string is then book-ended with ‘$’ and ‘!’ to make it a bit more complex. You can control the length of the password by passing in a number between 1 – 32. The password it will generate will be 3 – 32 characters long.

Download Shell Script

To Use:

  1. Unzip and stick the script somewhere in your PATH.
  2. Make the script executable: chmod +x randpass
  3. Run randpass to generate a random password. Pass in a number from 1 – 32 to control how long a password it will generate for you.