LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 07-03-2010, 03:57 AM   #1
the_gripmaster
Member
 
Registered: Jul 2004
Location: VIC, Australia
Distribution: RHEL, CentOS, Ubuntu Server, Ubuntu
Posts: 364

Rep: Reputation: 38
How to monitor changed file


How do I monitor which files have been changed after, say, I run the passwd command? (I know, depending on the options used, it changes /etc/shadow and/or /etc/passwd). But I would like to if there is any clever ways of monitoring this.

This is how I do it which is a bit crude, and I have to know which directory to monitor.
Before running the command, I run
Code:
for i in $(ls -A) do; md5sum $i >> /tmp/before; done
And after running the command, I run
Code:
for i in $(ls -A) do; md5sum $i >> /tmp/after; done
Then I do a diff to see if any file has been changed
Code:
diff /tmp/{before,after}
But I believe there is a better way than this.
 
Old 07-03-2010, 04:01 AM   #2
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 15,056

Rep: Reputation: 1915Reputation: 1915Reputation: 1915Reputation: 1915Reputation: 1915Reputation: 1915Reputation: 1915Reputation: 1915Reputation: 1915Reputation: 1915Reputation: 1915
Have a look at inotify-tools.
 
  


Reply


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
Resolution in 1 monitor suddenly Changed? dlemas Linux - Newbie 1 06-21-2010 02:19 PM
Monitor changed but linux is not booting... hemcrop Linux - Newbie 1 08-30-2008 11:15 AM
Broken X after changed monitor settings? badbunny Linux - Newbie 2 10-27-2005 12:14 PM
Monitor settings won't stay changed msandford Linux - Hardware 7 03-07-2005 12:35 PM
Changed monitor rez, now black screen? EnVoy Mandriva 3 11-18-2003 03:51 AM


All times are GMT -5. The time now is 07:41 PM.

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