Editing text file with Vim does not update tail -f
If you edit a file with vim
, typically it reads the file into memory, then writes a new file. So tail
is now operating on an out of date copy of the file (which remains in the file system until tail
(and any other program) stops using it.
You can make tail
follow the filename (rather than the file) by using:
tail -F yourfile
Note the upper case F
.
My understanding is that typically when editing with vim
, you are editing a copy of the file, which is moved into place when you write your changes to disk. Since this happens by unlink
ing the original and move
ing the new into place, tail
does not see new changes to the original file.