Search code examples
linuxrandomcattail

Why is cat /dev/random output changing?


Using cat /dev/random on my machine (Ubuntu 14.04) in Terminal yields unexpected results. If I'm not mistaken, cat should basically output the contents of the file and that's it, but in my case cat prints out random gibberish (as expected) and then continues to output more random gibberish every 5 seconds or so.

I've tried usingtail -f /dev/random to see how the file changes but this surprisingly yields no output.

What is going on here?


Solution

  • It's not a (regular) file, first thing. It's a "character special file".

    http://man7.org/linux/man-pages/man4/random.4.html

    https://unix.stackexchange.com/questions/60034/what-are-character-special-and-block-special-files-in-a-unix-system

    Think of it as a "water fountain of random bytes".