Linux Articles, Shell Scripts February 25, 2008 0

Random password generator – Losowe generowanie haseł

Random Password generator – let’s generate the password from within the urandom mess….

For the beginning let’s issue the following command (cancel it by Ctrl+c !!):

$cat /dev/urandom

It shows us, where the script takes its random strings from, further used for the password generation

  • As a result of below command will be 5 lines of printed marks:
< /dev/urandom tr -cd '[:graph:]' | fold -w 8 | head -n 5
  • in result of the following command we’ll get 5 lines of letters:
< /dev/urandom tr -cd '[:alpha:]' | fold -w 8 | head -n 5
  • below example returns letters + digits which are alphanumeric marks – x lines:
< /dev/urandom tr -cd '[:alnum:]' | fold -w 8 | head -n x # x - number of returned lines for ex.: 100

Quick “tr” How To:

# alnum
# alpha
# blank
# cntrl
# digit
# graph
# lower
# print
# punct
# space
# upper
# xdigit
– Letters numbers
– Letters
– levels white mark?
– control marks
– digits
– printed marks, excluding spaces
– lower case
– printed marks including spaces
– punctuation mark
– vertical or horizontal white mark (space)
– upper case
– HEX digits

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.