Where do files and directories go when I run 'rm -rf folder_or_file_name' in Ubuntu 10.04?

5,241

Solution 1

From the man page:

Note that if you use rm to remove a file, it is usually possible to recover the contents of that file. If you want more assurance that the contents are truly unrecoverable, consider using shred.

I believe that rm -rf simply removes the link to the file. In other words, it doesn't write the file over with 0's or anything (which is what I'm assuming shred does), but it makes the file unable to be found without special tools.

If you're hoping that the files go to some other kind of trash / recycle bin though, I'm afraid you're out of luck. rm -rf is pretty much the universal "make sure you know that this will get rid of your files no second chance" command.

Solution 2

As far as I know a 'rm' command completely removes files and directories. There are "undelete" options, but there is no such thing as a "Trash" or "Recycle Bin"

Solution 3

John is correct. When you do an rm, it removes the directory entry which points to the file. The file's contents are still on disk, but have no associated entry. The contents will remain on disk until the blocks containing those contents are reused. This could be almost immediately, or could be never, depending on the type of disk, the disk firmware, and the number of writes to the disk.

If you have inadvertently deleted a file and want to recover it, first find out what your filesystem type is. You can do this by typing 'mount' and then looking at the 'type' field. I don't know what Ubuntu uses by default, but it will probably be something like ext4 or (if you're lucky) ext3.

Then do a Google search for "undelete " If you discovered that your filesystem is ext4, you will search for "undelete ext4". Choose whichever tool looks the least sketchy and then try using it.

Share:
5,241
max
Author by

max

Updated on September 18, 2022

Comments

  • max
    max over 1 year

    When I delete folders or files in the Nautilus GUI, those folders/files go to Trash but where do folders/files go when I run rm -rf folder_or_file_name in terminal in Ubuntu 10.04?