rm -rf -Mitigating the dangers

David Christensen dpchrist at holgerdanske.com
Sun Apr 17 22:33:37 UTC 2016


On 04/17/2016 10:10 AM, Odhiambo Washington wrote:
> I am wondering if I should place a feature request on this or just do it my
> way:)
>
> With great power comes great responsibility and as such I think there
> should be a wrapper around rm to warn sysadmins that what they are about to
> do with -rf is dangerous, yes?
>
> Read input from sysadmin 3 times, looking strictly for their confirmation
> before effecting the `rm -rf`.
>
> Could it be that what I am smoking/drinking is the issue here or I have
> your support? LOL

I have this in my .bashrc:

     alias rm='rm -i --one-file-system'

So, an accidental 'rm -rf' should limit destruction to one file system.


Perhaps what you're looking for is a command-line equivalent of desktop 
trash cans.  STFW this is not a new idea and there are existing solutions.


David




More information about the freebsd-questions mailing list