Statement
cat /dev/random
keeps producing output, as expected, but
tail -f /dev/random
hangs (at least on OSX and SUSE). Why the latter statement hangs?
cat /dev/urandom will give you a stream of random bytes between 0 and 255 , not all of those values are valid text characters. Because the terminal window was feed invalid data it was never expected to handle it could get the terminal application in to a "broken" state. Follow this answer to receive notifications.
There is no difference between /dev/random and /dev/urandom; both behave identically. Apple's iOS also uses Yarrow.
The /dev/urandom device provides a reliable source of random output, however the output will not be generated from an equal amount of random input if insufficient input is available.
Generating random numbers You can use /dev/urandom to generate pseudo-random numbers on the command line like this. Commands like this that pull data from /dev/urandom and use od to process it can generate nearly random numbers. Run the same command numerous times and you'll see that you get a range of numbers.
tail -f
does several things:
/dev/random
).If there is no end -- as is the case for /dev/random
-- that first step will never complete.
cat
does not need to find an end to seek back from it, and so it has no point of failure associated.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With