shell产生随机数

1:random

[root@linhexiao shellTest]# echo "$RANDOM"
[root@linhexiao shellTest]# echo "$RANDOM$(date +%N%t)"|md5sum |cut -c 5-12

 2:openssl

[root@linhexiao shellTest]# openssl rand -base64 8
[root@linhexiao shellTest]# openssl rand -base64 8|md5sum | cut -c 5-12

 3:date

[root@linhexiao shellTest]# date +%s
1460550703
[root@linhexiao shellTest]# date +%s%N

 4:

[root@linhexiao shellTest]# head /dev/urandom|cksum
4036467423 2069

 5:UUID

cat /proc/sys/kernel/random/uuid

 6:expect

[root@linhexiao shellTest]# yum -y install expect
[root@linhexiao shellTest]# mkpasswd
?L4oIiw6u
[root@linhexiao shellTest]# mkpasswd -l 10
r5th7FWlg;
[root@linhexiao shellTest]# mkpasswd -l 10 -s 0
3fn2aObtXt

猜你喜欢

转载自linhexiao.iteye.com/blog/2290788