4 ms·
mv uses rename(). No issue with the target file existing beforehand. No issue with symlinks going stale, because they link to the name not the inode. Hard li
by mhandley 4y ago
mv uses rename(). No issue with the target file existing beforehand. No issue with symlinks going stale, because they link to the name not the inode. Hard links will preserve the old file and still refer to that though (which is sometimes what you want, sometimes not). But for most, symlinks are far more common.
$ echo "File 1" > file1
$ echo "File 2" > file2
$ ln -s file2 file3
$ cat file3
File 2
$ echo "File 4" > file4
$ mv file4 file2
$ cat file3
File 4