How to know what files got deleted

data-recoveryfiles

I'm working on Ubuntu 13.04. yesterday from a Windows 7 partition, I accidentally deleted many files. I deleted by pressing shift-del.

Is there any way to know the name of the files that got deleted? If I'm able to get the names, I will make out how important the files are? If they are important I will try to recover or else I won't try. With no idea on whether log files can reveal that, I checked syslog file generated for that day but I couldn't find any information regarding that.

Best Answer

No there isn't generally any log that is maintained that keeps track of what files were deleted. About the only thing I can think of outside of trying to undelete the files using something like this Q&A: undelete files from local fileserver, is you could take a look at your system's locate command. It keeps a full list of all the files on a system, it's typically run nightly via cron, so you might find a list of the file names there, assuming you know what directories they were in.

Example

To get a list of all the files in my $HOME directory.

$ locate /home/saml | head -5
/home/saml
/home/saml/.Fontmatrix
/home/saml/.ICEauthority
/home/saml/.Trash
/home/saml/.VirtualBox

UPDATE #1

This approach would work so long as 2 conditions are met.

  1. The Windows 7 partition was mounted during the window of time that the cronjob that runs the indexing of the HDD (typically this: /etc/cron.daily/mlocate). This task runs daily, so if the partition is mounted one day but not the next, the data for that partition will get erased.
  2. The mlocate crontab entry hasn't run yet, with those files now erased.

NOTE: This option is what I would consider a last ditch effort, something before resorting to actually attempting to recover the files using one of the many undelete methods covered on Unix & Linux. You have a very small window of opportunity to get a listing of files that were on your system from the mlocate database but have been deleted.

Related Question