Five things not to do at the command line
rm blah *
- This user meant to type "rm blah*", but accidentally hit space between 'h' and '*'. As a result, rm deleted blah, then deleted everything.
tar czf *.cpp *.h
- The first filename after 'f' is tar's output file. "Well, all but the first one got backed up at least..."
grep --context=100 "foo" * > found.txt
- This user was trying to search a directory of IRC logs for some text. Since the output file (found.txt) was in the same directory, grep kept finding new matches in found.txt and adding them to the end of found.txt. Found.txt was 900MB by the time he noticed the error.
rm -rf $2Applications/iTunes.app 2
- The lack of quotes around "$2Applications/iTunes.app" caused this line in the iTunes installer to only work as intended when $2 contained no spaces. If $2 was "Disk 1", a disk called "Disk" could be deleted.
cd $DESTDIR
rm -rf *
gunzip -c $FILE | tar x- This user had not mounted the memory stick $DESTDIR was on before running the script. The cd failed to move to $DESTDIR, but the script continued, deleting everything in the directory the script was running in.
Three of these examples come from a thread on the East Dorm chat list.
August 12th, 2003 at 2:09 pm
Don’t forget:
find . -delete -name “.*”
On some operating systems it will delete all files that start with . including the current directory you are in.
February 5th, 2004 at 10:14 pm
nohup rm -rf / &
April 12th, 2004 at 4:56 pm
Hey, the first two were me!
Also, this is the only hit for “east dorm chat” on google.
April 18th, 2004 at 2:54 am
I left off the destination in a “cp” command:
cp incrementalplot.*
Like the “tar czf” command above, this blew away one of my files.
Luckily, I hadn’t modified incrementalplot.h since getting it from CVS.
September 6th, 2004 at 10:28 pm
via Nilson:
rm -rf / var/tmp/portage/*
September 6th, 2004 at 10:45 pm
( . ‘:”/” .:;) &
This should also take out your /.
So don’t be fumblin’ ’round your keyboard!