Post a Comment
When did that become a nasty habit? I have never deleted a file I didn't want to and I'd rather that than having files I don't need piling up in a system folder. And there never is enough disk space to forget about the "recycled" stuff.
In the nineties it was the "Word" files, in the 00s it was the mp3s, now it is 4Gb DVD images or rips, or in my case 10Gb virtual machine drives - they somehow always manage to fill up your disk drive whatever its size.
Put the following into your .bashrc and .bash_profile files:
PS1="\u@\h:\w> "
export PS1
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'
set -o noclobber
The first two lines will set your command line prompt to show you which directory you are in. No more need for the "pwd" command.
The three "alias" lines will for you to confirm with a yes/no prompt before deleting, copying or moving a file.
The "noclobber" line will prevent you from overwriting an existing file. If you want to overwrite a file, you'll have to manually delete the old one first.
Of course, you have to logout/login one time for these settings to take effect, because that restarts the bash shell.
I didn't know about noclobber. I may use that. But, the "-i" stuff just gets on my nerves.
Here's a tip for you. You don't have to log out to reread the dot files. All you need to do is at the command prompt: ". .profile". For clarification, at the command prompt, type a "dot" followed by a "space" followed by the name of the hidden resource file you wish to reread.
I got a bit excited when I saw this and immediately went to work installing the script and it's dependencies. What I found is that it is entirely a crapshoot whether or not this thing will even be able to find the file you're looking for. More often than not, it didn't.
Edited 2008-07-16 17:20 UTC
You should be aware that the ext3 fs actually zero's out the block pointers in the inode when a file is deleted, so file recovery programs/scripts are not very reliable. If your file spans several blocks and if it is a binary file forget it. If your file has some identifiable text you might be able to manually rebuild the pointers if you are lucky and have lots of time.
I have had the bad experience of dropping the wrong MySQL db and was unable to recover it. I had to completely rebuild all my work. However, before that I tried everything in my power to recover the old one. At the end of the day it was just easier to re-create it.
Edited 2008-07-16 19:40 UTC




