Last Updated: March 07, 2016
·
14.2K
· clowder

Random string generator, Bash

cat /dev/random | tr -dc "[:alpha:]" | head -c 8

If you hit an Illegal byte sequence error try...

cat /dev/random | LC_CTYPE=C tr -dc "[:alpha:]" | head -c 8

2 Responses
Add your response

Found I needed LC_ALL on bash v4.2 in OSX Terminal

over 1 year ago ·

Thank you very much - just what I was looking for. Was headed this direction, but this made the trip much nicer!

over 1 year ago ·