Linux special file

/dev/null

--Linux will disccard the any data written to /dev/null

--reading data from /dev/null results in an end-of-file

/dev/zero

it will genreate a zero data when reading from /dev/zero

for example, dd if=/dev/zero of=ab.txt count=10

/dev/full

The entry /dev/full behaves as if it were a file on a file system that has no more room.

扫描二维码关注公众号,回复: 8296314 查看本文章

/dev/random or /dev/urandom

The special devices /dev/random and /dev/urandom provide access to the Linux kernel’s built-in random number–generation facility.

Using od command to see what happen when you move mouse or typing something 

od -t x1 /dev/random

for /dev/urandom, it will never stop. e.g. od -t x1 /dev/urandom

Most software functions for generating random numbers, such as the rand function in the standard C library, actually generate pseudorandom numbers

Although these numbers satisfy some properties of random numbers, they are reproducible: If you start with the same seed value, you’ll obtain the same sequence of pseudorandom numbers every time.

To obtain better random numbers in computer programs requires an external source of randomness, use /dev/random or /dev/urandom

If you try to read a large number of bytes from /dev/random but don’t generate any input actions (you don’t type, move the mouse, or perform a similar action), Linux blocks the read operation.

猜你喜欢

转载自www.cnblogs.com/zjbfvfv/p/12090804.html