|
|
|
|
|
by em-bee
455 days ago
|
|
'--force' does more than undoing '--interactive'. '--force' will remove a file even if the permissions of that file are set to read only (if you own the file or directory): > touch foo
> ls -l
-rw-r--r--. 1 foo foo 0 Mar 24 05:54 foo
> chmod a-w foo
> ls -l
-r--r--r--. 1 foo foo 0 Mar 24 05:54 foo
> rm foo
rm: remove write-protected regular empty file 'foo'? n
> rm -i foo
rm: remove write-protected regular empty file 'foo'? n
> rm -i -f foo
>
my consequence is that i never alias 'rm' to default to '-i', because 'rm -f' is dangerous. instead i type 'rm -i' manually every time, and remove the '-i' if i don't want it. |
|
My alias is intended to provide the same protection against accidental deletions of non-write-protected files. I only pass the `-f` when I'm certain I know what I'm doing.
If I still want the raw behavior as you called out, I can use the full path to `rm`. But for me, I've unintentionally lost more files that I have write permissions on through bad rm commands than any lost from my alias with `-f`, which I can't recall having lost any with.