方法1 tr + head
tr -cd 'a-zA-Z0-9' </dev/urandom |head -c8
方法2 date +md5sum/sha512sum + head
date +%N
date +%N |md5sum |head -c10
方法3 RANDOM环境变量
echo $((RANDOM+10000000))
方法4 uuidgen
uuidgen |cut -b 1-8
方法5 mkpasswd
mkpasswd|cut -b 1-8
方法6 openssl
openssl rand -base64 8
trYjiXa7NfI=
方法7 strings
strings /dev/urandom | tr -cd 'a-zA-Z0-9' |head -c8
方法8 gpg
gpg --gen-random -armor 1 12
网友评论