生成全字符随机的字串:

cat /dev/urandom | strings -n C | head -n L

生成数字加字母的随机字串:

cat /dev/urandom | sed 's/[^a-zA-Z0-9]//g' | strings -n C | head -n L

其中C表示字符串的字符数,L表示要生成多少行字符。