When you create a new file, it belongs to you.
When you append to a file with
file, the owner doesn't change
because UNIX doesn't have to create a new file.
When you rename a file with mv, the ownership doesn't change.
Exception: if you use mv to move a file to, the moved file will belong to you - because, to move across filesystems, mv actually has to copy the file and delete the original.
When you copy a file,.
When you edit a file:
With an editor like, the file keeps its original owner because a new file is never created.
An editor like, which makes a backup copy, can be different. The backup copy could belong to you or to the original owner. If you replace the edited file with its backup, the file's ownership might have changed:
emacs filea...Edit a lot, then decide you don't want your changes... %
mv filea~ filea
If you aren't sure, use.