If we use the tail command we can listen for events representing changes to the files length (in bytes).I am looking for a way to listen for events when the content of the file changes but the length is the same. Specifically, looking to listen for changes to the first or second line of the file.(We might expect that the head command can do this, but it does not seem like the head command can listen for changes, it merely grabs the beginning of content.)Does anyone know if it's possible to listen for changes to a file's content (the beginning of the file specifically)?Note there is a process appending data to the file and another process reading and removing the first line of the file.I am interested in independently listening for changes to the head of the file, but I don't want to capture, or I want to be able to filter out, events that append to the file.
Use head command or similar to determine when bytes change in a file
files;monitoring;tail;head