//View Tip #882
» Find occurrences of a string in a large code base without firing
» My code is compiling
» Find files greater than a certain size
» Local/remote webserver
Rob Hutten
Similar Tips
» Counts files in the current directory and subdirectory» Find occurrences of a string in a large code base without firing
» My code is compiling
» Find files greater than a certain size
» Local/remote webserver
Latest tips by RSS
Click here to subscribe
Follow Shell-Fu on Twitter
Click here to follow
Follow Shell-Fu on identi.ca
Click here to follow
To find the last modified files in a directory you can use ls -ltr. To find the last modified file on a file system it will not work, but the following command will work:
find /etc -type f -printf "%T@ %T+ %p" | sort -n
Comments
Add your comment
#1
Nice one. I had to add a \n after the %p, though.
Posted 2009-09-15 11:01:36
Yes, I also had to add '\n'. I also piped through 'sort -rn|head' to limit the output. It's also possible to speed things up by using the test '-cnewer' in 'find'. Just picking any file in the directory your searching. If you don't get any output you've managed to pick the most recent modified file.
Posted 2009-09-16 00:30:55
i believe you are a good writer, but have you erver thought to write some special artcals for peopel who likes shopping very much.
Posted 2010-07-15 22:42:45

