|
|
sweetfresa14
Fresh Boarder
Blog Posts: 0
Forum Posts: 9
Rating: 0  
|
|
Could somebody tell me how to recover deleted files? I use Redhat Linux. I accidentally deleted an important file(s) using rm command.
i know there's a command sort of related to 'shadow' but i don't remember how to do it exactly.
what is the general method for users to recover deleted files in Linux machines? what about the easiest way? In Windows machine, there's a recycle bin. Is there such one in Linux? I also use Gnome and KDE, how can i recover files in these GUI?
Thank you for your helps.
|
|
|
laju
Fresh Boarder
Blog Posts: 0
Forum Posts: 14
Rating: 0  
|
|
Umm... as far as I am aware, if a file is removed with 'rm' it's really gone. Various GUIs may implement a recycle-bin but command line stuff does not.
The same is true with Windows, of course, where the DEL command is
|
|
|
ejtaal
Fresh Boarder
Blog Posts: 0
Forum Posts: 13
Rating: 0  
|
|
The preferred method is not to delete them in the first place, but failing that, restoring the file from your most recent backup generally works well.
There are several 'recycle-bin' type utilities for linux but I've never used them. You could check google or freshmeat to see what's available.
If you avoid running as the 'root' user unnecessarily the chances of deleting important system files is greatly reduced. Important user files should be backed up regularly by the owners. If not much disk activity has transpired since the file was deleted you could try one of the ext2 undelete utilities out there. 'Midnight commander' has one with a nice ncurses interface. But if this is a busy system, there is a good chance that the blocks used by the file have already been overwritten.
|
|
|
Angel-xan
Fresh Boarder
Blog Posts: 0
Forum Posts: 15
Rating: 0  
|
|
The Right Way involves using whatever backup system you are using to preserve important files on your systems.
If you are not using any backup system, then your options may be limited or even non-existent.
Consider this to be a vital reason to look into backing things up, so that you won't lose important files in the future.
The best answer you are likely to get is 'the more painful the loss, the more strongly you will understand the importance of backups.'
|
|
|
sophia8
Fresh Boarder
Blog Posts: 0
Forum Posts: 10
Rating: 0  
|
|
thanks for all the replies. I totally agree the concept of backup. and i do have that. I just created the abc.java file 10 minutes ago, then i deleted this file accidentally because i thought that's the abc.class file, and my backup application run every 2 hours.
it is really so hard for Linux system to implement a undelete command? (i know Dos and windows have it).
Is it a good idea to put an alias 'rm' on my .cshrc or .bashrc files, and what rm actually does is to 'cp' the files to a 'deleted' folder, and write a script to clean out the stuff in this folder every 2 weeks using 'cron'?
will it work actually? ( i am only a programmer and not good at Linux system administration).
|
|
|
dsojda
Fresh Boarder
Blog Posts: 0
Forum Posts: 10
Rating: 0  
|
|
/ ...
It is very easy. Just create an alias:
$ alias rm='my_delete'
Then create a script called 'my_delete' in /usr/local/bin:
*********************************************
#!/bin/sh
DEL_DIR=~/removed_files
if ...
It is very easy. Just create an alias:
$ alias rm='my_delete'
Then create a script called 'my_delete' in /usr/local/bin:
*********************************************
#!/bin/sh
DEL_DIR=~/removed_files
if [ '$1'
|
|
|
EldonSmith
Fresh Boarder
Blog Posts: 0
Forum Posts: 6
Rating: 0  
|
|
If its not too long ago since u deleted the file u can try the command 'recover' or its gui alternative gtk-recover. also read the undelete howto on tldp.org for info how and when these will work.
|
|
|
ejtaal
Fresh Boarder
Blog Posts: 0
Forum Posts: 13
Rating: 0  
|
|
Read 'Ext2fs-Undeletion' mini-HOWTO. To summarize, if /dev/hdb1 is the location of filesystem from which the file was deleted,
1. determine time of deletion, ownership, and permission.
2. umount /dev/hdb1 debugfs /dev/hdb1 > lsdel > stat <12345> > dump <12345> file.001 > quit
'debugfs' can be piped from stdin, ie. echo 'lsdel' debugfs /dev/hdb1 > lsdel.txt
|
|
|
|
The Content on this site is provided for general information purposes only. Your use of the Content, or any part thereof, is made solely at Your own risk and responsibility. By entering this site you declare you read and agreed to its Terms, Rules & Privacy.
Copyright © 2006 - 2010 My Linux Gang
|
TIP: Write your question in details [ why? ]
|