Questions tagged [tail]

Watching updates at the end of a file, with or without the tail utility

To tail a file means to keep it open and watch new lines that are appended to it by some other program.

tail is a classic Unix text processing utility which displays the last few lines of a file. It introduced “follow mode”, where the file is kept open and the utility prints new lines as they appear.

Use this tag when tailing files, regardless of whether you are using the tail utility itself. A question about using tail which isn't about follow mode should probably use the tag. Not to be confused with the Tails operating system . For monitoring of changes to files in general, see .

Common tailing utilities

Further reading

424 questions
120
votes
5 answers

Does tail read the whole file?

If I want to tail a 25 GB textfile, does the tail command read the whole file? Since a file might be scattered on a disk I imagine it has to, but I do not understand such internals well.
66
votes
8 answers

How to tail multiple files using tail -0f in Linux/AIX

I tried tailing two files using the option: tail -0f file1.log -0f file2.log In Linux I see an error "tail : can process only one file at a time". In AIX I see the error as "Invalid options". This works fine when I use: tail -f file1 -f file 2 in…
Web Nash
  • 2,283
54
votes
2 answers

What is the difference between "tail -f" and "tail -F"?

I never used tail -F command instead always used tail -f however someone told me that -F is better without much explanation. I looked up man page for tail command. -f output appended data as the file grows; -F Same as --follow=name --retry --retry…
DaeYoung
  • 875
37
votes
8 answers

How to quit `tail -f` mode without using `Ctrl+c`?

When I do tail -f filename, how to quit the mode without use Ctrl+c to kill the process? What I want is a normal way to quit, like q in top. I am just curious about the question, because I feel that killing the process is not a good way to quit…
Key Shang
  • 859
31
votes
1 answer

Do I need to worry about "tail: unrecognized file system type 0xbeefdead"?

I'm trying to follow a regular text file with tail -f -n 50 filename. I get the information from the file just fine, except I always get this error message: tail: unrecognized file system type 0xbeefdead It happens on every file. The 0xbeefdead…
kwknowles
  • 413
24
votes
2 answers

tail -f, but when the file is deleted and re-created (not appended)

I'm trying to watch for any new output of a log file. Another script (not under my control) is deleting the file then creating a new one with the same name. Using tail -f doesn't work because the file is being deleted.
20
votes
6 answers

Show filename at begining of each line when tailing multiple files at once?

when tailing multiple files at once as shown below, is any there any way to show the file name at the start of each line? tail -f one.log two.log current output ==> one.log <== contents of one.log here... contents of one.log here... ==> two.log…
mtk
  • 27,530
  • 35
  • 94
  • 130
11
votes
1 answer

tail -f but suck in content of the file first (aka `cat -f`)

I need to display whole file before tracking it for a new changes, not only the last 10 lines (yep, I know it's not tail conceptually). In other words, something like cat -f would do, if it would ever existed. Tail's man doesn't give me any ideas.…
10
votes
2 answers

tail files in a directory without file name and header

The following script works to cat all files in a directory without header but prints the file name. How can I cat without file name. tail -n +2 * >> Compile
canswiss
  • 101
7
votes
1 answer

"tail -s N" does not sleep for N seconds before updating

The manual for GNU tail says -s, --sleep-interval=N with -f, sleep for approximately N seconds (default 1.0) between iterations; with inotify and --pid=P, check process P at least once every N seconds But when I write tail --sleep-interval=10 -F…
6
votes
1 answer

Is it possible to tail -f output to a single line?

less has an option -S or --chop-lines which prevents lines from wrapping and shows output as one line (often extended beyond screen). Is it possible to do this with tail -f? The tail man page doesn't say anything about it.
6
votes
3 answers

What does "tail -f " do?

I don't understand the function of the option -f added to the tail command. I know that tail views the "last" part of a file. The manual says that -f outputs appended data as the file grows But I don't really understand what that means. I know the…
5
votes
5 answers

tail -f a file for 10 minutes / until N matching lines?

I've got a log file that I process as follows: grep pattern /var/log/whatever.log | \ cut ... | sort | uniq -c | sort -rn | \ etc.... However, the log file is quite big, and records events from the beginning of the day. It's also appended…
4
votes
5 answers

Tail a file for specific text

Is there a Linux command similar to tail where instead of specifying a number of lines you can specify a string of text, the file would be searched for that text from the last line to the first and then display all or a specified number lines after…
4
votes
5 answers

exit tail when other process is done

I have parallel --j 2 -- "sh script1" "sh script2" where script1 and script2 log in files log1 and log2 I would like to change this to: parallel --j 3 -- "sh script1" "sh script2" "tail -f log1 log2" The reason to use tail is when I allow the two…
gsf
  • 183
  • 6
1
2