Help answer threads with 0 replies.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 12-14-2007, 04:05 AM   #1
LQ Newbie
Registered: Dec 2007
Posts: 3

Rep: Reputation: 0
Is there a way to find out -when- a file got deleted?

See topic :P

We're trying to figure out why 3 rather important files are missing on a box.

Restoring the files is not an issue, we're just trying to nail down what caused them to be deleted in first place.
Old 12-14-2007, 05:20 AM   #2
Registered: Aug 2007
Distribution: openSUSE
Posts: 102

Rep: Reputation: 24
You should protect your 'rather important files' by giving almost no one rights to delete those files.
If only root can delete them, you know who did it, because only 1 (or 2) people know your root password....

Luckily you have a backup of you files...
Old 12-14-2007, 05:26 AM   #3
Registered: Jan 2007
Posts: 35

Rep: Reputation: 15
Try to view the /var/log directory. Usually the system records all of the things you do on your system. You can view with "cat dmesg" and try to do a grep on the file that you are looking for.

e.g. cat /var/log/messages | grep -i filename
cat /var/log/dmesg | grep -i filename
Old 12-14-2007, 05:53 AM   #4
LQ Newbie
Registered: Dec 2007
Posts: 3

Original Poster
Rep: Reputation: 0
I'll try that, thanks.

We installed the Oracle 10g Binaries and the 10g Grid Control Agent on one of our servers (with several productive 9.2.0 DBs) - and now it's missing it's listener.ora/tnsnames.ora files from /ora/app/oracle/network/admin. We're trying to figure out which of the two installations caused that - if either was the reason.
Old 12-14-2007, 05:57 AM   #5
Senior Member
Registered: Oct 2003
Location: UK
Distribution: Kubuntu 12.10 (using awesome wm though)
Posts: 3,530

Rep: Reputation: 65
Generally no. At least directly.

The modification time for the directory is updated if a file is deleted from it, so if no other file deletion, rename or creation events have taken place since these important files were deleted, you might be able to work it out like that. It's a lot of 'if's though.

Another approach would be to check your incremental backups (you do have incremental backups, right)? Checking your daily backups will at least put an upper and lower bound on the date and time of removal.

If you're trying to work out how they got deleted, make sure you save the bash history file from all users who have rwx permissions on the parent directory. You can check through the commands executed to see if you can work out what happened.

If these files are used by some application (which now malfunctions), perhaps you can find clues about the time from the fallout of the failure. Without more information it is impossible for me to say.
Old 12-14-2007, 08:23 AM   #6
LQ Newbie
Registered: Dec 2007
Posts: 3

Original Poster
Rep: Reputation: 0
Originally Posted by matthewg42 View Post
The modification time for the directory is updated if a file is deleted from it
Thanks to that advice and some putty logfiles (we already had replaced the missing files again) we were able to solve the mystery :P

Thanks !
Old 12-14-2007, 09:02 AM   #7
LQ Newbie
Registered: Nov 2003
Location: Bangalore
Distribution: Fedora core 6
Posts: 19

Rep: Reputation: 1
A quick tip Which might help prevent Future file deletion .Set the Files attribute
using chattr +i (Imutable) attribute so that files doesnt get deleted
unless until root changes the attribute intentionally and then deletes it.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
i deleted my .bashrc file koolhead17 SUSE / openSUSE 3 06-23-2006 01:39 AM
File deleted but icon still there Pg2k3 Linux - Newbie 4 02-01-2006 07:35 PM
How to find deleted files? Nickj Linux - General 8 07-18-2005 07:20 PM
Help: Accidently deleted file patske Linux - Newbie 5 02-17-2004 09:34 AM
Deleted file klmn1 Linux - Software 2 12-12-2003 06:04 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:55 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration