Zettel 202109141140 : Helpful mv Command Options
The b flag creates a backup of the destination file.
The mv command creates a backup in the destination directory. This protects against overwrites.
$ ls
somefile.txt
$ mv -b somefile.txt /home/destination
$ ls /home/destination
somefile.txt somefile.txt~
The file with the tilde (~) character is the backup. That is a copy of the file that the mv command would have overwritten.
Another helpful option is the u flag.
The update or u flag only overwrites a file if the source is newer than the destination file. This flag also has the i or interactive option built into it.
September 14, 2021 unlinked cli