I think I would say the most accurate concise description for that is it
replaces the directory entry for the file.
First, the original file is RM'd.
this may not delete the file, if there are additional hard links to it. RM lowers the link counter on the file, and if the counter hits zero, it
then marks the blocks of the file as available for reuse.
Then the replacement file's directory entry is moved from its current folder to the folder of the object it is replacing.
Terminal won't let you replace a folder with a file, it will move the file INTO the folder. Trying to replace a file with a folder will get you an error.
When I select "replace", does this mean that the "old" file is immediately overwritten with the new, or is the "old" file simply moved/flagged to be overwritten when more space on the HD is required at a later time (i.e. similar to emptying the trash)?
CAT and DD could do an in-place-overwrite as you are considering, but that's pretty unusual. Normally when replacing, a file's directory entry is overwritten ("totally destroyed, immediately") and the blocks of the overwritten file are marked as available for reuse later when the file system finds them convenient to use. (which could be in a minute, a week, or four years) Blocks aren't necessarily reclaimed in order, and may get overwritten in segments as time goes on because files aren't always stored using one continuous strip of blocks. This makes deleted-file-recovery an uncertain and unpredictable affair. (see my other recent post regarding aliases for an explanation of how multiple hard links to a file can complicate deleting a file)
If you do a "secure delete" however, THAT
will wipe the blocks to random values before freeing them. HOWEVER, if you've copied or edited the file, there's a very good chance there are many copies of older versions of the file scattered around the hard drive, NONE of which the secure delete will do anything to. Some may have already been overwritten completely, some may have had parts of them overwritten, and some may be fully intact, years later. If you have a file that you want to be able to edit AND secure-delete later, your only good alternative is to store the file on a (non-growable) disk image, and secure delete the dmg when you need to make the file(s) go away for certain.