LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 06-08-2010, 05:38 PM   #1
devnull10
Member
 
Registered: Jan 2010
Location: Lancashire
Distribution: Slackware Stable
Posts: 572

Rep: Reputation: 120Reputation: 120
Schoolboy error - arrrggghhh!!!


So I downloaded some files to my home directory which were named similarly with the exception of the last part, eg screenshot1001.jog, screenshot1002.jpg and so on.. I had about 20 of these and wanted to delete them all, so I did "rm screenshot*".
However - that's not what I did!!! I stupidly, and for some reason unknown to man did "rm screenshot *"!!!!!!
Lost a crap load of files from my home directory as a result!!!

Anyone know how I might get these back (using ext4 filesystem)? I've tried extundelete but had no luck.

Yes, I know I should probably alias rm to rm -i but I'm not a linux n00b and have been using it for years without any problem. I think only having four hours sleep last night didn't help either as I am not concentrating!!

Last edited by devnull10; 06-08-2010 at 05:43 PM.
 
Old 06-08-2010, 05:55 PM   #2
smeezekitty
Senior Member
 
Registered: Sep 2009
Location: Washington U.S.
Distribution: M$ Windows / Debian / Ubuntu / DSL / many others
Posts: 2,339

Rep: Reputation: 231Reputation: 231Reputation: 231
Never tried it but i have heard of test disk.
 
Old 06-08-2010, 06:13 PM   #3
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
Moved: This thread is more suitable in <Linux - General> and has been moved accordingly to help your thread/question get the exposure it deserves.
 
Old 06-08-2010, 06:19 PM   #4
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
Quote:
Originally Posted by devnull10 View Post

Yes, I know I should probably alias rm to rm -i but I'm not a linux n00b and have been using it for years without any problem. I think only having four hours sleep last night didn't help either as I am not concentrating!!
What I like to do in ~ , ~/documents and ~/downloads (e.g.,) is
to "touch ./-i" ... works in most situations (unless you have
other files in the dir by names of -[a-h]*).



Cheers,
Tink
 
1 members found this post helpful.
Old 06-08-2010, 06:29 PM   #5
devnull10
Member
 
Registered: Jan 2010
Location: Lancashire
Distribution: Slackware Stable
Posts: 572

Original Poster
Rep: Reputation: 120Reputation: 120
Hi,
Yes, I suppose that would have the same effect as alias'ing but only happens in chosen directories. I just find it too intrusive sometimes that's all but then again I guess I am never going to want to run "rm *" in my home dir! If I did want to remove using wildcards then it wouldn't be matched.
Can I be sure that the -i file will always be hit first (ie, other files won't be deleted first)?

I've also set up a cron job to backup /home weekly (will change to daily when I eventually get around to having an external file server) to a separate partition. I know it would be better doing a remote backup but unfortunately I don't have the facilities to do this.
 
Old 06-08-2010, 08:49 PM   #6
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
As i said with the "caveat" ... the * will (by default) glob files in ASCII
order. So if you have (other) files that start with unusual character they
may get killed. So file names starting with
Code:
040 SPACE
041 !
042 "
043 #
044 $
045 %
046 &
047 ´
050 (
051 )
052 *
053 +
054 ,
or
Code:
-a
.
.
-h
may be wiped ... now *I* don't have any of those, ymmv.


Cheers,
Tink
 
Old 06-09-2010, 02:26 PM   #7
arizonagroovejet
Senior Member
 
Registered: Jun 2005
Location: England
Distribution: openSUSE, Fedora, CentOS
Posts: 1,094

Rep: Reputation: 198Reputation: 198
On the bright side, you now understand the value of a back up and anyone else reading this who doesn't have a back up of things they care about will hopefully now understand why they should.


FWIW I've been using *nix command lines for about fifteen years and not only do I always make sure I have rm aliased to 'rm -i' but I also do it for cp and mv. Without -i, cp and mv will silently overwrite an existing file with the target name if it exists.

Everyone makes a typo once in a while. I've lost files as the result of typos and that's why I now alias rm, cp and mv. If you want to delete a bunch of stuff without being asked you can always use -f. If you use -f read what you typed at least twice before hitting enter!
 
Old 06-09-2010, 03:28 PM   #8
devnull10
Member
 
Registered: Jan 2010
Location: Lancashire
Distribution: Slackware Stable
Posts: 572

Original Poster
Rep: Reputation: 120Reputation: 120
Yep, definitely a valuable lesson. Like I say, I have been using linux for quite a few years now and use unix at work and have always been fine and usually check any such commands. It was just a costly mistake made I think because I wasn't concentrating properly!
Tinkster - I very rarely (in fact probably never) have filenames which start with anything other than an ascii character so i should be ok!
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Memory error: extended error chipkill ecc error rajivdp Linux - Hardware 1 12-07-2009 08:26 AM
Sendmail: eocket wedge , 504 error , dsn error, mail relay connection error djcs Debian 0 03-03-2009 12:41 AM
Suse CUPS error: cups(File)DoRequest error:client-error-bad-request smdonelan Linux - Hardware 6 04-17-2007 06:46 PM
ATI Radeon 9000, fglrx, ... ARRRGGGHHH!!! zZeta Linux - Hardware 4 01-03-2005 10:27 PM
xmodmap -e "pointer = 1 2 3 6 7 4 5" = ARRRGGGHHH!! kadaver Slackware 1 11-18-2003 08:50 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 02:55 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration