I know tail prints the last few lines of a file. I read the documentation for tail
man tail
and it says
the
-f
option causes a tail to not stop when end of file is reached but rather to wait for additional data to be appended to the input.
I tested the commands
tail -f sample.txt
and
tail sample.txt
and saw what the difference was. But can someone provide a real life example of why they would use tail -f
instead of just tail
?
-f
is used for when you have an expectation that someone will come along and append to the file while you are watching it. Most commonly it is used in log files (loggers will add lines to the end of files and this is great for watching those), but I've also used it to watch information appended to a CSV file.
When you're viewing a log file that's being generated by a running process.
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