Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 05 Jul 2005 11:27:43 +0100
From:      Alex Zbyslaw <xfb52@dial.pipex.com>
To:        steve lasiter <slas7713@yahoo.com>
Cc:        FreeBSD-Questions@FreeBSD.ORG
Subject:   Re: accidental overwrite
Message-ID:  <42CA609F.3040701@dial.pipex.com>
In-Reply-To: <20050704231717.88135.qmail@web33612.mail.mud.yahoo.com>
References:  <20050704231717.88135.qmail@web33612.mail.mud.yahoo.com>

next in thread | previous in thread | raw e-mail | index | archive | help
steve lasiter wrote:

>until today when I tried to copy over a .sql file so
>MySQL could see it and run it. I accidentally copied
>it over to /usr/local/bin/mysql thinking mysql was a
>directory. 
>  
>
>My question(s) are: Is there any way to revert back to
>the original file if this type of mistake is made? 
>  
>
Anyone, running any computer with any operating system who does not keep 
backups is asking for trouble.  FreeBSD is no different to anything else 
in that regard.  In this case you destroyed a file which has virtual 
backup in the form of the Internet.  Recover it by re-installing the 
package.

Some simple rules you could follow to try and avoid doing this again:

1) Don't do something as root unless you have to.

2) Explore the -i options to cp, mv and rm and set them up as aliases 
for your own account and for root.  This is not foolproof because there 
are dozens of utilities which can also overwrite files (tar, rsync, 
rdist, scp, cpio to name a few).

3) Explore options your shell might have to avoid overwriting files.  
E.g. tcsh has noclobber and you shell will have something similar.

4) Modern shells have command-line expansion.  Use it to expand the 
target of your cp to see if it already exists or not, is a directory or 
not etc.

5) Unix of any kind is the single most complicated "thing" you will ever 
use in your life.  Buy a book; read the handbook; read manual pages.  
Learn about it and you can hopefully minimise the mistakes.

6) Make backups regularly.  Not everything is on the internet.  There 
are many options from CDs, through flash sticks, to tapes and 
autochangers.  You can add another disk to your PC or to another PC.  
You can do more than of these.  You should use them regularly if you 
consider your data to be precious.

--Alex





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?42CA609F.3040701>