How to find a file which is being written recently in directory of 1000 files?
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.
if you know a part of the name or the extension (.txt, .zip, ...)
try something like
Code:
find -mmin 5 | grep *.txt
because when you do only the find command, you get maybe more than 100 files , execute it with a pipeline and the grep command, you will be more specific , so you get a better view of your files
(because you said how to find A file, you can either try my suggestion or one of the above )
GL
Last edited by brownie_cookie; 04-13-2011 at 01:03 AM.
Go inside the directory and try find ./ -name "filename", or find ./ -name "filename*"( if you do not the file extension ) . If you know how many days ago was the file was last edited, you can try find ./ -mtime 1 (or 2,3,4,5,etc the number represents how many days prior to the currect date). You can also try grep -r filename ./
I see you guys pretty much answered but let me add my 5 cents. You need to have idea how recently you want it to be. If you have an idea that it is 0-10 days ago you can generate a report like this:
Code:
# for i in {0..10};do echo "$i days ago:" ;find . -mtime $i ;done;
0 days ago:
.
./a
1 days ago:
2 days ago:
3 days ago:
4 days ago:
5 days ago:
6 days ago:
7 days ago:
8 days ago:
9 days ago:
10 days ago:
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.