Linux tip: How to list / find only today files
Sometime in your working day, you created a text file, which now is urgently required. The problem is that you can’t remember what name you gave it, your home folder(or other folder) is full of over 1000 different files. You are probably familiar with the problem. The question is how can you find the file? There are various ways, but this tip shows you the power of pipes and joining together two powerful shell commands:
ls -al –time-style=+%D | grep `date +%D`
The parameters to the ls command here cause the datestamp to be output in a particular format. The cunning bit is that the output is then passed to grep. The grep parameter is itself a command (executed because of the backticks), which substitutes the current date into the string to be matched. You could easily modify it to search specifically for other dates, times, filesizes or whatever. Combine it and that’s it!
Tags | Howto, Linux, Tips and Tricks
You could of course just do it properly
find -mtime -1