3 ms·
> Alias: rm > Command: rm -r Purpose: Because when I type "rm" I don't want to always have to specify "-r" for a directory. Alias: cp Command: cp -r Purpose: Sa
by gdevenyi 3y ago
> Alias: rm
> Command: rm -r
Purpose: Because when I type "rm" I don't want to always have to specify "-r" for a directory.
Alias: cp
Command: cp -r
Purpose: Same as above. When I say "copy this" I always want it to copy whatever I'm specifying, even if it's a directory.
This is insanely dangerous. Don't do this.
- deafpolygon 3y agoAgreed. I like that you need to use '-r' ... it's that extra layer of safety and intention. A whole directory gone is a bit hard to recover from.
- metal 3y agoDo this in important directories for added safety: $ touch -- - i This creates a file called "-i" which will add the interactive flag, prompting you before deleting every file that rm was going to delete.
- Galanwe 3y agoThat seems flaky at best. Basically you rely on "*" expansion to inject the -i. While that may work for `rm -rf *`, it won't for `rm -rf foo/*`, `rm -rf foo`, etc
- metal 3y agoThat's the point. You're not relying on it, it's a safety to save yourself from an unintended glob expansion.
- Groxx 3y agoOr for far better reliability, just use safety and add that to the config.
- cassepipe 3y agoA way better solution is to alias trash-d as a drop-in replacement for `rm` : https://github.com/rushsteve1/trash-d https://github.com/rushsteve1/trash-d
- ttyprintk 3y agoAlso, ‘gio trash’ is widespread.
- cassepipe 3y agoNever heard of it before, let's man gio : gio is a utility that makes many of the GIO features available Ok, thanks I guess :D
- ttyprintk 3y agoWhat I mean is: a precept of command-line fluency is to be able to drop onto arbitrary systems and change them in ways predictable to the next sysadmin. ‘gio’ is a vague entry point to a library, and even if the next sysadmin doesn’t know about gnome, the files you trashed end up in a common recycling bin. On the other hand, KDE has a syntax that deserves an alias.
- mturmon 3y agoAgree. (I actually feel the same way about aliasing rm to “rm -i“). I depend on the out of box behavior of rm. I’ll run “rm *” in a directory that has subdirectories I want to preserve, but where I want to erase the files.