Generate random string for various use case
2016-08-08
90 words
1 min read
Some times I need random string, for example to use as email seperator or to use in some API. One way is to use tools like /dev/[u]random or od and other such. But they seem cubersome after I figured this out.
openssl rand <length> openssl rand 10
This alone without some parameters is not interesting thoug. You can use ‘-base64’ or ‘-hex’ to select the encoding.
So if you execute the above you will get something like this
$ openssl rand -hex 10 591e96110af8aecb760b $ openssl rand -base64 10 TnuUXuiZXv2ktw==
Related Articles:
- 2016/01/05 image ordering by Original Date Time using bash script
- 2015/10/15 Get count of lines in scripts (shell)
- 2014/09/22 bash – refer the first parameter from last command quickly
- 2010/05/25 Filename handling with space and newline character.
- 0001/01/01 parse and paste text

Authored By Amit Agarwal
Amit Agarwal, Linux and Photography are my hobbies.Creative Commons Attribution 4.0 International License.