"cat /dev/random" versus "tail -f /dev/random"
tail -f
does several things:
- Find the end of the stream, either by reading until reaching an EOF or by doing a seek to the end (an operation not available on
/dev/random
). - Back up a certain length (possibly by retaining a buffer of an appropriate length of contents recently read, possibly by retaining a list of seek positions for the last N lines during the initial scan, or by some other means), and print the contents between that point and the end.
- Continue to print new contents past that point as such contents become available.
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.