Find the answer to your Linux question:
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 12
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Aug 2006
    Location
    London Uk
    Posts
    93

    is it not possible to recover files deleted using rm


    i am wondering is it possible to recover files deleted by using the command rm. if yes, how do i do it?

    i am also wondering how to forward the file to trash instead of deleting off the system.

  2. #2
    Linux Guru Cabhan's Avatar
    Join Date
    Jan 2005
    Location
    Seattle, WA, USA
    Posts
    3,252
    Correct. Linux does not use a trash bin by default (GNOME and KDE use it, but not if you use rm). You can recover files as long as you haven't overwritten them yet, but this requires some other technique that I don't know.

    As far as how to make stuff go to the trash instead of deleted, run this as root:
    Code:
    mv /usr/bin/rm /usr/bin/rm.bak
    Now copy this script and save it as /usr/bin/rm:
    Code:
    #!/bin/bash
    
    mkdir ~/.Trash &> /dev/null
    
    while [ ! -z "$1" ]; do
        mv "$1" ~/.Trash/
        shift
    done
    This will, instead of deleting files, move them to the .Trash directory in your home directory, and you can delete them for real later.

  3. #3
    Banned jan1024188's Avatar
    Join Date
    Jul 2006
    Location
    EU, SLOVENIA
    Posts
    1,549
    im afraid that when you used rm command (before editing /usr/bin/rm)this command deleted the last hard link to the file...thre are some people which are searching for peaces and getting file together but....

  4. $spacer_open
    $spacer_close
  5. #4
    I'd try Foremost or TestDisk. Both can recover deleted files if the pieces haven't been written over yet.

  6. #5

    Its really Good one to know about

    Hi

    This is Sushil i was browsing on the Net to see how to recover the Files once deleted so when i came across this site and saw the way u have replied to it i felt its a really a very good way which can be very much helpfull.. Looking at this i was really very much impressed nad hav joined the group today itself .

    Thank You
    M. Sushil


    Quote Originally Posted by Cabhan
    Correct. Linux does not use a trash bin by default (GNOME and KDE use it, but not if you use rm). You can recover files as long as you haven't overwritten them yet, but this requires some other technique that I don't know.

    As far as how to make stuff go to the trash instead of deleted, run this as root:
    Code:
    mv /usr/bin/rm /usr/bin/rm.bak
    Now copy this script and save it as /usr/bin/rm:
    Code:
    #!/bin/bash
    
    mkdir ~/.Trash &> /dev/null
    
    while [ ! -z "$1" ]; do
        mv "$1" ~/.Trash/
        shift
    done
    This will, instead of deleting files, move them to the .Trash directory in your home directory, and you can delete them for real later.

  7. #6
    Linux Enthusiast likwid's Avatar
    Join Date
    Dec 2006
    Location
    MA
    Posts
    649
    You can recover deleted files with debugfs. Though not near as reliable as turning rm into a script that moves things to a trash bin.

  8. #7
    Linux Guru Lakshmipathi's Avatar
    Join Date
    Sep 2006
    Location
    3rd rock from sun - Often seen near moon
    Posts
    1,842

    Lightbulb

    It depends the file system you are using.
    If deleted file from ext2 or fat ,only its link is broken.you can recover files if they are not overwritten.
    If you are using ext3fs then it's quite hard to recover.
    I developed ext3fs recovery-but it can recover files only after it's installation.

    Quote Originally Posted by msk_0984
    Hi
    Looking at this i was really very much impressed nad hav joined the group today itself .
    welcome sushil ,yes this is really cool site
    First they ignore you,Then they laugh at you,Then they fight with you,Then you win. - M.K.Gandhi
    -----
    FOSS India Award winning ext3fs Undelete tool www.giis.co.in. Online Linux Terminal http://www.webminal.org

  9. #8
    Banned jan1024188's Avatar
    Join Date
    Jul 2006
    Location
    EU, SLOVENIA
    Posts
    1,549
    So is possible to recover files??? But how??? I dont understand that....if there is no hardlink to the file you cant open it, but is still there?

    I think I should learn a lot about filesystems.....

  10. #9
    Quote Originally Posted by jan1024188
    So is possible to recover files??? But how??? I dont understand that....if there is no hardlink to the file you cant open it, but is still there?

    I think I should learn a lot about filesystems.....
    Ok what he means is that when you delete something in ext2 or fat the file isn't actually fully deleted, it's simply marked as free space. So at that point the OS sees that portion of the hard drive as free space and is free to write whatever it wants to it. However using recovery software you can if you are lucky recover the file. That software is able to search your drive for the file and remark it as used space. The problem comes if you've used the hard drive since the file was deleted there is a possibility that all or part of the file could have been overwritten.

  11. #10
    Banned jan1024188's Avatar
    Join Date
    Jul 2006
    Location
    EU, SLOVENIA
    Posts
    1,549
    Quote Originally Posted by Jaidan
    Ok what he means is that when you delete something in ext2 or fat the file isn't actually fully deleted, it's simply marked as free space. So at that point the OS sees that portion of the hard drive as free space and is free to write whatever it wants to it. However using recovery software you can if you are lucky recover the file. That software is able to search your drive for the file and remark it as used space. The problem comes if you've used the hard drive since the file was deleted there is a possibility that all or part of the file could have been overwritten.
    cool....thats verry practic....but probably new filesystems as jfs and ntfs dont support that....am I right???


    One more question:
    When formating partition as ext2.... Does partitioning proram just deletes links
    or all on the disk?
    When you delete for example photo....can you recover it?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •