Normally, a program such as
cat terminates when the
read() system call first returns 0 bytes of data, treating it as EOF (end of file). Normally, the
tail program does the same; without the
-f option, it finds the end of the file and reads backwards to find the last 10 (by default) lines. ('Reads backwards' means 'seeks backwards and reads some data'.)
-f (follow) option is used, the
tail command recognizes the 0 byte return, but does not terminate. Instead, it goes to sleep for a short period, and then tries to read some more data. If the file is a log file that is growing as a process (for example, a web server or database server) writes more information, then
tail -f will show the extra information more or less as it appears.
Another use for this is on long-running compilations. You set the compilation running in the background and writing its output to a log file. In the foreground, you run
tail -f on the log file, and when you spot a problem, you can interrupt the
tail without breaking the compilation.