4 ms·
Better yet: don't remove things. Move them to a folder. My rm is aliased to a 'mv to a trahs folder' function. I have aliased rrm for real rm. Guis know this,
by DanielRibeiro 15y ago
Better yet: don't remove things. Move them to a folder. My rm is aliased to a 'mv to a trahs folder' function. I have aliased rrm for real rm.
Guis know this, but somehow this piece of UX is forgotten on command line tools.
- makecheck 15y agoIt's really more effective to have a very regular backup (e.g. ".snapshot" directories are really nice), because you can't control all the ways a file may be deleted. Just because you protect one "rm" command doesn't mean there isn't another. Someone might have used unlink() in a Perl script or a C program. Maybe "mv" was used to write one file over another, or "cat >! filename", or a dozen other things. In the end, if a file needs to be safe then it needs a backup (and the sooner it can be restored, the better). And then given a good backup the file still needs an appropriate Unix group, owner, file access control list, etc. to minimize the chance that you'll ever need the backup.
- philh 15y agoNote that 'sudo rm' doesn't care about your aliases. It would be safer to replace the binary.
- deleted 15y ago[deleted]
- re_todd 15y agoCool idea. I usually move folders and files to the /tmp/ folder instead of deleting them. The next time I boot up, they are gone.
- billswift 15y agoThe problem with using /tmp is that you may not realize something critical has been deleted until you reboot. Using an explicit trash or backups folder is safer.
- derleth 15y ago> somehow this piece of UX is forgotten on command line tools Because command line tools were first, and are used by people who do need to remove files, to clear disk space. If you're never deleting anything, how do you clear disk space?
- billswift 15y agoUse a script to alias rm to a mv command. Then to really delete something explicitly use /bin/rm.