Reputation: 707
tail -F -c +0 call.log
I have know that -F
means monitor call.log
as it changes.However,what does -c +0
mean here? Are -c
and +0
working together or seperately?
Upvotes: 0
Views: 850
Reputation: 6527
tail
prints the tailing part of the file, 10 lines by default. With -f
, it keeps the file open after this, and "follows up" on it, printing any new contents as it appears. With -F
, it doesn't follow the open file descriptor, but repeatedly checks for the file by name, in case the underlying file changes by way of being renamed or recreated.
The -c +0
tells it to output the file starting at byte 0 (because of the plus), so the whole file. And in combination with -F
it continues following the file name after this.
So the effect is to print the whole file, then follow up on any new contents on the same file, or another that afterwards take the same name.
See the man page for the individual options, and try e.g.,
$ seq 10 > file.txt
$ tail -c +0 -F file.txt
and from another window:
$ echo hello > file.txt
Upvotes: 1
Reputation: 20966
There is a site I loved from the first glance explainshell.com
Upvotes: 1