4 ms·
At least for me, over 90% of unintentional file deletions (not counting ill-considered deletions) are due to mv and cp rather than rm. Being careless with them
by LegionMammal978 1y ago
At least for me, over 90% of unintentional file deletions (not counting ill-considered deletions) are due to mv and cp rather than rm. Being careless with them can easily end up overwriting a file's contents with another. For instance, once I was typing out a few commands of form "cp foo.txt bar.txt baz/", but I inadvertently hit Enter before writing "baz/", causing bar.txt to get overwritten with foo.txt. I don't know of any good solution for this issue, apart from my current rule of thumb never to use more than two arguments at a time.
- scbrg 1y agoIf you're using the GNU implementations; --no-clobber, --backup or --update. Can be aliased too.
- danillonunes 1y agoI don't know exactly what's the logic but sometimes I need to confirm a rm operation with an "y". Maybe cp and mv should have the same behavior for destructive operations.
- setopt 1y ago> I don't know exactly what's the logic but sometimes I need to confirm a rm operation with an "y". I believe some Linux distributions alias rm to either rm -i or -I in their default shell config.