生成全字符随机的字串:
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
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表示要生成多少行字符。
本文转自holy2009 51CTO博客,原文链接:http://blog.51cto.com/holy2010/376127