The following is a one-liner for generating a random string of a fixed size in bash, where the possible characters to use in the string are any digit, letter, and a newline.
By adding the newline, you are fairly sure to prevent getting one long line of text.
< /dev/urandom tr -dc "[:digit:][:alpha:][\n]" | head -c1000 file.out
→ Continue reading “Generate a Random String of a Specified Size with a Shell Script”