Generating random strings with openssl

Quickly need a string of random characters? Just use the ‘openssl’ command like this:

benjamin@plug:~$ openssl rand -hex 20

Update 2017-01-10

I’m always greatful when people take the time to write me an e-mail that can improve a post. So this update is brought to you by Robert, thank you very much! By his benchmarks the below method is about 100% quicker (it could however be a bit less accurate but sometimes speed is more important):

benjamin@nas:~$ od -An -x -N 20 /dev/random|tr -d " \n"