产生10个随机密码

作者:吴炳锡 来源:http://www.mysqlsupport.cn/ 联系方式: wubingxi#gmail.com 转载请注明作/译者和出处,并且不能用于商业用途,违者必究.

cat /dev/urandom | LC_ALL=C tr -dc "[:alnum:]" | fold -w 10 |head -10

Si1N9kUyuZ
ddzsRXFgxA
caDRBRT4Px
buGk6LkX4d
N5Xod1TOyr
1645cBxAjl
KRjwJR2Txu
nhQedXagL9
RraDEZgfhY
QxCurm5eZF

 

Expression Semantics
alnum Matches alpha-numeric characters
alpha Matches alphabetic characters
blank Matches spaces or tabs
cntrl Matches control characters
digit Matches numeric digits
graph Matches non-space printing characters
lower Matches lower case letters
print Matches printable characters
punct Matches punctuation symbols
space Matches spaces, tabs, returns, and newlines
upper Matches upper case letters
xdigit Matches hexadecimal digits

 

如果需要特别复杂的密码可以试一下:

cat /dev/urandom | LC_ALL=C tr -dc "[:graph:]" | fold -w 10 |head -10

y#@uDo.g-w
RP\oq.8?)e
2R~CCIsLPr
*/V4″%H9WE
!iP2Jj:vqL
zb!w}DZ|lN
2*%|/;X$?>
R7;-Bam|~L
Ps83,_`8Xz
C?mnpUzn*I

另一种方法可以利用uuid 来产生一个密码,一次只能产生一个:

cat /proc/sys/kernel/random/uuid|tr -d "-"

d9d01c59d22f4ebbac16b759103f4fc6

2 Comments