I'm writing continuously to a file, and I want to tail it from another shell. But it seems that as long as the file is open for writing,
tail -f filename
can't show all the new lines until the file is closed again.
Unfortunately, opening and closing the file many times a second slows my script down to the point where data is received faster than it can be written, so I can't close the file during the process.
The writing is being done by a python program:
ser = serial.Serial('/dev/ttyACM2',9600) f = open("filename", "a+") while True: s = ser.readline() f.write(s + "\r\n")
Isn't there a way to view the contents of a file that is in the process of being written to?