Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 17 Apr 2016 22:51:02 -0600 (MDT)
From:      Warren Block <wblock@wonkity.com>
To:        "Kevin P. Neal" <kpn@neutralgood.org>
Cc:        freebsd-questions@freebsd.org
Subject:   Re:  rm -rf -Mitigating the dangers
Message-ID:  <alpine.BSF.2.20.1604172241110.93193@wonkity.com>
In-Reply-To: <20160418001110.GA82868@neutralgood.org>
References:  <CAAdA2WNqWACnjiUSHhYWL1nEj=YGPPURqJHsAcjaXYacziXsfg@mail.gmail.com> <57140EA2.6020503@holgerdanske.com> <20160418001110.GA82868@neutralgood.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, 17 Apr 2016, Kevin P. Neal wrote:

> On Sun, Apr 17, 2016 at 03:30:58PM -0700, David Christensen wrote:
>> 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.
>
> And, for those occasions where your job is on the line, it is important
> to know that "pwd" and "/bin/pwd" do _not_ work the same. If you really
> want to know where you are before you do a "rm -rf *" then you must use
> the "/bin/pwd" command.

I suggest to never give rm -rf an unqualified "*".  Using a path with
rm -rf doesn't make it safe, but it does make it safer.  It's a good 
protective habit to develop.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?alpine.BSF.2.20.1604172241110.93193>