Linux special file
Posted 荷树栋
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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.
/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.
以上是关于Linux special file的主要内容,如果未能解决你的问题,请参考以下文章