how do you undelete files in linux?

holycow

Senior member
Feb 28, 2001
330
0
0
how do you undelete files in linux(redhat and gentoo)? i accidentally delete some files and i haven't had a chance to back it up before the deletion..
 

n0cmonkey

Elite Member
Jun 10, 2001
42,936
1
0
If you deleted them through KDE or Gnome, there might be a trash can or something. I don't know. If you deleted them on the command line, you can try various file recovery tools. But general consensus is, don't make mistakes.
 

n0cmonkey

Elite Member
Jun 10, 2001
42,936
1
0
Something I did when I started using Linux was to alias the rm command. I created something like ~/.trash, and aliased rm to mv $1 ~/.trash or something. Can't remember exactly, maybe it was a script like that. Either way, I'd have to remember to delete everything from ~/.trash on occassion :p
 

NewBlackDak

Senior member
Sep 16, 2003
530
0
0
They're only retrievable if nothing else has been written to that block on the HDD. Generally, you're just screwed.

What I do is make a "~/.trash" directory. I have a script that when you type rm it really mv's the files to ~/.trash
 

Barnaby W. Füi

Elite Member
Aug 14, 2001
12,343
0
0
Functions do a great job of filling the space between aliases (too simple) and scripts (too lazy to create a file and whatnot). :)
 

n0cmonkey

Elite Member
Jun 10, 2001
42,936
1
0
Originally posted by: BingBongWongFooey
Functions do a great job of filling the space between aliases (too simple) and scripts (too lazy to create a file and whatnot). :)

I'd never seen that before. I don't pay attention to most shell things though. :p Might have to play with it sometime, just for fun. See if it works on pdksh ;)

I usually keep a ~/admin directory around with most of my "common" scripts.