I have done the following operations:
- echo "test" >> t1
- echo "test2" >> t2
- ln t1 l1
- cp t2 t1
- cat l1
To my surprise after overwriting t1 with t2 the hard link was still working. As per my understanding when you create a new version of a file the hard link is not pointed to the new version.
Why after using the cat command on hard link [after overwriting] the hard link is still valid and pointing to the content of the new t1 file?