I am using Ubuntu (the latest release).
In Ubuntu, I type
gedit filename and after saving the file, I type
sudo gedit filename (it gave me a warning), but what surprise me is that, it didn't show me the original file, and give me a "new file"(also named "filename") which is empty. so I get confused, and I try to type
sudo) again, and the original file shows again. It seems that these "two" files are stored in different place, since I can edit non-sudo file and sudo-file respectively.
The operating above are based on the command-line, and if I open the file via GUI approach, Ubuntu will show me the file which I didn't type
But in the case of macOS (macOS 10.13), the
sudo command is only used to improve permissions, and of course I cannot get "two" different files.
So, can anyone help me on this issue, why using
sudo command to edit files can lead to such a situation? And does that mean these two files belong to two different users(in Ubuntu situation)?