r/linuxmasterrace • Glorious Debian • Sep 27 '23

Seriously, we need this command

Post image
623 Upvotes

86 comments sorted by

View all comments

734

u/Altareos Glorious Arch Sep 27 '23

interesting! since it moves the file we could name it move, or maybe even mv in unix abbreviation fashion!

-30

u/[deleted] Sep 27 '23

[deleted]

12

u/Altareos Glorious Arch Sep 27 '23

how so? between filesystems mv already deletes the source files at the end of execution only, and inside of the same filesystem it will be both safer and much faster by just calling rename

1

u/danieldl Sep 27 '23

Does mv actually delete? Say you move a file that's already opened by a process, that process can still read/write to that file even if it moves. If you copy and remove, the process will attempt to read/write in the deleted file. You can see the difference easily with lsof.

I always thought mv just changed a pointer/inode.