Linux - NewbieThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I need to know which files in multiple folders have been changed within a specified time period. I only know how to access Linux via putty, so please be specific if you can help.
Thank you! The files I am looking for (testing purposes) are not showing, but I am getting a good list (which is all that is needed for my usual purpose).
My new question is: How do I get just the last day? I changed the comment to find -mtime -5 -mtime +0 but it still is not showing my test file. Is it possible to get recent results?
-mtime -1 by itself should do the trick. You need to bear in mind that it
will always compare against the current timestamp, and go back 24 hours.
If that's not the granularity you're after have a look into mmin instead,
which will look at the passed minutes.
Thank you very much! One more question: Does this show only those files modified or does it also show files added or removed (or one or the other)?
I'm guessing only those modified...
Creating a new file is a modification (if you think about it - it can't have a
modify time-stamp that's older than the file's creation time). So a file
newly created should show up as well.
Awesome! Thanks so much for your help!!! I'm also assuming from your last comment about time stamps that files deleted would not be included because there is no time stamp.
You're most welcome. And you're right - a deleted file doesn't have any allocated
inodes, and hence doesn't have time-stamps. In other words: with plain OS means
you can't find out whether a file has been deleted.
For that kind of thing you could use programs like AIDE or tripwire, which watch
for changes based on a schedule (e.g. every 30 minutes). You could use samhain
which allows for real-time monitoring (I think it does - been a while that I last
looked into it because it was quite heavy on CPU) or build your own based on e.g.
the dazuko library.
If that's more than you asked for, and you're not really after intrusion detection,
you could use a simple cron-job to take a directory listing every minute, compare
it against the previous run and notify you of changes. The greatest short-coming
of this would be the 1-minute granularity. In other words if something got created
and deleted within the 1-minute time-frame you'd never know about it.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.