Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to generate random numbers by shell

2025-03-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces shell how to generate random numbers, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let Xiaobian take you to understand.

One: RANDOM

Echo $RANDOM

The random number of RANDOM has a range of 1Murray 32767, which can be cracked generally.

1.2 generate an eight-digit random password:

Echo $(($RANDOM+11111111))

Second: the password generated by MD5sum random encryption method is long.

Take a 9-digit password:

Echo $RADDOM | md5sum | cut-c 2-9

Three: generate random numbers through openssl

[root@web01 tmp] # openssl rand-base64 8

HInfIvtfOSk=

[root@web01 tmp] # openssl rand-base64 10

T67TCWO4DquFjAfee =

[root@web01 tmp] #

Four: get random numbers through time

Date +% s% N (s seconds N)

[root@web01 tmp] # date +% s% N

1494493822328919977

[root@web01 tmp] #

Five: mkpasswd

To use mkpasswd, first download expect

Yum install expect-y

[root@web01 scripts] # mkpasswd-l 10

\ dhr (V56zpT

[root@web01 scripts] # mkpasswd-l 18

UxtxtiLuk09wzDd [ga

[root@web01 scripts] #

6: device: / dev/urandom | cksum

[root@web01 scripts] # head / dev/urandom | cksum

3839730751 3262

[root@web01 scripts] #

Seven: the full name of the uid code is the only universal identification code:

[root@web01 scripts] # cat / proc/sys/kernel/random/uuid

Dbe7d254-11c2-42cc-b541-3f2a990daa8e

[root@web01 scripts] #

Thank you for reading this article carefully. I hope the article "how to generate random numbers in shell" shared by the editor will be helpful to everyone. At the same time, I also hope that you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Network Security

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report