From owner-freebsd-questions@FreeBSD.ORG Sun May 6 03:24:33 2007 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id CA9B416A402 for ; Sun, 6 May 2007 03:24:33 +0000 (UTC) (envelope-from carpetsmoker@rwxrwxrwx.net) Received: from mail.rwxrwxrwx.net (carpetsmoker.xs4all.nl [82.93.23.199]) by mx1.freebsd.org (Postfix) with ESMTP id 7768E13C469 for ; Sun, 6 May 2007 03:24:33 +0000 (UTC) (envelope-from carpetsmoker@rwxrwxrwx.net) Received: by mail.rwxrwxrwx.net (Postfix, from userid 1001) id 19FBA6D46E; Sun, 6 May 2007 05:23:14 +0200 (CEST) Date: Sun, 6 May 2007 05:23:13 +0200 From: Martin Tournoij To: freebsd-questions@freebsd.org Message-ID: <20070506032313.GA6098@glitch.rwxrwxrwx.net> Mail-Followup-To: freebsd-questions@freebsd.org, ray@stilltech.net References: <200705051705.43504.ray@stilltech.net> <20070506005530.GA5251@glitch.rwxrwxrwx.net> <463D2B0C.2030603@u.washington.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <463D2B0C.2030603@u.washington.edu> User-Agent: mutt-ng/devel-r804 (FreeBSD) Cc: ray@stilltech.net Subject: Re: disaster recovery - did I do the right thing? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 May 2007 03:24:33 -0000 On Sat 05 May 2007 18:05, Garrett Cooper wrote: > Martin Tournoij wrote: > >On Sat 05 May 2007 17:05, Ray wrote: > >>Hello all, > >>I did something stupid the other day (sleep deprivation combined with a "clever" hack were the main reasons), and I'm just curious if I did > >>the right thing afterwards. > >> > >>The mistake: > >>/usr/local/# rm -f * > >>note that root was running bash as a shell at the time, found in /usr/local/bin or something. > >> > >>What I did was to start over, reinstall from scratch. > >>my question, was there an easier way? > >>thanks, > >>Ray > >You can use pkg_info -ga to check for missing files in your packages. > > For (t)csh: > alias rm "rm -i" > > For (ba)sh: > alias rm="rm -i" > > Now that you've learned :). > > Martin's suggestion is good though -- would have done that considering that all that lived in /usr/local were ports. > > -Garrett The problem with this is that it will ask confirmation for every file it deleted. Which is gets pretty annoying after a while, also, if you delete a directory containing a 100 files, you will have to press 'y' a 100 times. This will probably lead to the habit of using 'rm -f', and/or simply pressing y all the time without actually looking at the confirmation message. In any case, it's not likely to prevent any such accidents. A better solution would be to write a script that would move files instead of deleting them. You should name this script to something else than rm, when you're working with a new or "foreign" system, you will expect rm to move files, instead of deleting them ... and we can all see another disaster coming there... Another hint would be the 'rmstar' option in tcsh, when set, tcsh will ask confirmation before executing 'rm *'. Note that aliasing 'cp' and 'mv' to 'cp -i' and 'mv -i' is an *extremely* wise idea, in the past I have often accidentally overwritten files that should not have been overwritten, leading to various problems. -- Regards, Martin Tournoij