I was working on the tutorial just now and wanted to delete all the *~
files. But instead of typing rm *~ I typed rm * and all the files
were silently deleted.
This could have been a tragedy if I didn’t have a recent backup made on a
sepparate directory. Since I did, I actually lost very little work.
Lesson of the day: Always backup. Eventually you’ll be glad you did.
I was working on the tutorial just now and wanted to delete all the *~
files. But instead of typing rm *~ I typed rm * and all the files
were silently deleted.
This could have been a tragedy if I didn’t have a recent backup made on a
sepparate directory. Since I did, I actually lost very little work.
Lesson of the day: Always backup. Eventually you’ll be glad you did.
Cheers,
Daniel.
Also:
CVS
alias rm=‘rm -i’
vim: set backupdir=/tmp [I presume the *~ files come from vim?]
I did something similar many years ago. I typed ‘rm * .bak’ instead of
‘rm *.bak’. The command deleted all my files and then politely informed
me that there wasn’t any file named ‘.bak’.
I now make it a standard practice to define a script called ‘rmbak’ that
deletes all the ~, .bak, etc. files. Therefore I almost never have to
type ‘rm’ with a ‘*’ anymore.
···
On Fri, 2002-12-06 at 23:40, Daniel Carrera wrote:
I was working on the tutorial just now and wanted to delete all the *~
files. But instead of typing rm *~ I typed rm * and all the files
were silently deleted.
I use Perforce both as a backup and as a means to avoid stupid mistakes.
It’s a great tool because you can have it run on another machine and thus
get physical redundancy. No way I’m going to let the command line or loss of
laptop destroy my data.
All files are readonly on the client which immediately prevents files from
being deleted, except file actively being edited which are not yet checked
in - hopefully these are still in the editor then.
Perforce is fast even over slow network. There are plugins for VIM and
emacs, MS Dev. Studio etc., though I prefer Scite as editor and just
manually check files in and out as it is quite easy.
Perforce comes for free for a two user licence which is otherwise
unrestricted. Perforce supports open source development, so it is possible
to get a free 2+ user license for such projects. I’d love to see more Open
Source projects use Perforce, as it is a really nice tool. The closest I’ve
ever got to CVS is online html browsing.
I’ve just purchased a cheap used IBM Thinkpad 240 with a new larger quieter
harddisk, which I plan to run as source control server over 802.11b w-lan
hidden away in a drawer somewhere, so I can replace my noise old tower
thingy.
I was working on the tutorial just now and wanted to delete all the *~
files. But instead of typing rm *~ I typed rm * and all the files
were silently deleted.
I have no patience for ‘rm -i’. Indeed, that was the default and I
unaliased it.
A better solution is to move to zsh. You can have zsh ask you if you are
sure only when you type ‘rm *’. I think I’ll do that at some poine.
vim: set backupdir=/tmp [I presume the *~ files come from vim?]
They come from Emacs. Do you know how to do the equivalent in Emacs?
I was working on the tutorial just now and wanted to delete all the *~
files. But instead of typing rm *~ I typed rm * and all the files
were silently deleted.
ah, the joys of unix. who hasn’t experienced that at one time or
another? i’ve had mistyped ‘rm * ~’ (extra space) and ‘rm *’
(missed hitting the “~” above the tab). i’ve witnessed my company’s
sysadmin wiped his whole mail directory. i’ve also heard other sad
stories. i have used midnight commander’s undelfs several times.
This could have been a tragedy if I didn’t have a recent backup made on a
sepparate directory. Since I did, I actually lost very little work.
Also:
CVS
alias rm=‘rm -i’
vim: set backupdir=/tmp [I presume the *~ files come from vim?]
although there is no substitute for backups, it’s amazing to see that
over the years the unix CLI hasn’t got a good replacement for “rm” that
does trash-can-thingy (or some filesystem features added on to
ext2/ext3/reiserfs that makes undeletion possible). the best distros
come up with is putting the “rm -i” alias. i find “rm -i” very annoying.
I was working on the tutorial just now and wanted to delete all the *~
files. But instead of typing rm *~ I typed rm * and all the files
were silently deleted.
This could have been a tragedy if I didn’t have a recent backup made on a
sepparate directory. Since I did, I actually lost very little work.
Lesson of the day: Always backup. Eventually you’ll be glad you did.
Cheers,
Daniel.
Also:
CVS
alias rm=‘rm -i’
vim: set backupdir=/tmp [I presume the *~ files come from vim?]
Instead of the alias for rm, you could place a file called “-i” [1],
in directories of importance (or all). This works well for multi-user
machines, because it then doesn’t matter whether the user has rm
aliased or not.
I have no patience for ‘rm -i’. Indeed, that was the default and I
unaliased it.
I don’t blame you, but it’s no big deal for a small number of files. When you
can stuck on a large number, and you’re sure you want to delete them, then
‘rm -f *’.
vim: set backupdir=/tmp [I presume the *~ files come from vim?]
They come from Emacs. Do you know how to do the equivalent in Emacs?
I usually have a ‘make clean’ in each of my project directories to
delete the junk specific to that project (usually ~ files and things
like latex intermediate stuff). Safer than using rm, and often handier.
although there is no substitute for backups, it’s amazing to see that
over the years the unix CLI hasn’t got a good replacement for “rm” that
does trash-can-thingy (or some filesystem features added on to
ext2/ext3/reiserfs that makes undeletion possible). the best distros
come up with is putting the “rm -i” alias. i find “rm -i” very annoying.
–
dave
Actually I saw an article somewhere that someone had come up with the
trash-can-thingy
but the Linux folks thought it was too MS Windowsy. I personally think it is
a good idea.
“This is the homepage of libtrash, a shared library which, when
preloaded, implements a trash can under GNU/Linux.”
… (or some filesystem features added on to ext2/ext3/reiserfs
that makes undeletion possible).
ext2 supports an undeletable attribute for files (that’s undelet-able,
not un-deletable). Files with that attribute set have their contents
saved when they are deleted, so they can be retrieved alter.
This could have been a tragedy if I didn’t have a recent backup made on a
sepparate directory. Since I did, I actually lost very little work.
Also:
CVS
alias rm=‘rm -i’
vim: set backupdir=/tmp [I presume the *~ files come from vim?]
although there is no substitute for backups, it’s amazing to see that
over the years the unix CLI hasn’t got a good replacement for “rm” that
does trash-can-thingy (or some filesystem features added on to
ext2/ext3/reiserfs that makes undeletion possible). the best distros
come up with is putting the “rm -i” alias. i find “rm -i” very annoying.
/usr/local/bin/recycle:
#!/bin/sh
mkdir -p “$HOME/.recycled”
for x in “$@”; do
if [ “echo "$x" | cut -f 1 -d /” != ‘’ ]; then
x=“pwd/$x”;
fi
y=“echo "$x" | sed 's/-/-_/g;s/\//--/g'”
mv “$x” “$HOME/.recycled/$y”
done
Instead of the alias for rm, you could place a file called “-i” [1],
in directories of importance (or all). This works well for multi-user
machines, because it then doesn’t matter whether the user has rm
aliased or not.
–ibz.
[1] - e.g. “touch – -i”
Yes, someone mentioned that, and I must say I think it’s very clever. Very
clever indeed.
Instead of the alias for rm, you could place a file called “-i” [1],
in directories of importance (or all). This works well for multi-user
machines, because it then doesn’t matter whether the user has rm
aliased or not.
I have no patience for ‘rm -i’. Indeed, that was the default and I
unaliased it.
I don’t blame you, but it’s no big deal for a small number of files. When you
can stuck on a large number, and you’re sure you want to delete them, then
‘rm -f *’.
vim: set backupdir=/tmp [I presume the *~ files come from vim?]
They come from Emacs. Do you know how to do the equivalent in Emacs?
-----Original Message-----
From: Gavin Sinclair [mailto:gsinclair@soyabean.com.au]
Sent: Saturday, December 07, 2002 12:26 AM
To: ruby-talk ML
Subject: Re: Thank God for backups
I have no patience for ‘rm -i’. Indeed, that was the default and I
unaliased it.
I don’t blame you, but it’s no big deal for a small number of files. When you
can stuck on a large number, and you’re sure you want to delete them, then
‘rm -f *’.
aliasing rm to rm -i is a common thing, but I generally see the unix neophytes
do it. Mainly because once you get used to that, moving to a machine where you
don’t have all your pet aliases is way, way more dangerous.
Learn the defaults and understand their implications. That way you’re never
surprised.
Documentation:
Alist of filename patterns and backup directory names.
Each element looks like (REGEXP . DIRECTORY). Backups of files with
names matching REGEXP will be made in DIRECTORY. DIRECTORY may be
relative or absolute. If it is absolute, so that all matching files
are backed up into the same directory, the file names in this
directory will be the full name of the file backed up with all
directory separators changed to `!’ to prevent clashes. This will not
work correctly if your filesystem truncates the resulting name.
For the common case of all backups going into one directory, the alist
should contain a single element pairing “.” with the appropriate
directory name.
If this variable is nil, or it fails to match a filename, the backup
is made in the original file’s directory.
On MS-DOS filesystems without long names this variable is always
ignored.
You can customize this variable.
Defined in `files’.
···
-----Original Message-----
From: zem [mailto:zem@timbit.novylen.net]On Behalf Of Martin DeMello
Sent: Saturday, December 07, 2002 2:35 AM
To: ruby-talk ML
Subject: Re: Thank God for backups
vim: set backupdir=/tmp [I presume the *~ files come from vim?]
They come from Emacs. Do you know how to do the equivalent in Emacs?
I usually have a ‘make clean’ in each of my project directories to
delete the junk specific to that project (usually ~ files and things
like latex intermediate stuff). Safer than using rm, and often handier.
yes, emacs is part of the blame (though i daily use ‘joe’). if only
emacs had used foo.bak… (and i’m also wondering if it had used
‘foo*’ :-p)
I’ve been putting a file named “-i” in my home directory for a while.
It saved me once!
when you issue the “rm *” command, your shell expands the wildcard to
all the files in the current directory before passing the arguments to
rm. rm scans the argument list looking for arguments before starting,
so a file named “-i” causes rm to enter interactive mode.
For emacs, you can re-define the make-backup-file-name. Below is a
good version which creates backup files in ~/.backups, replacing “/”
with “|”. If you just want to change the suffix, something like…