Find files in Linux by date - how it works
In this practical tip you will learn how to search for files by date in Linux.
How to find your files in Linux by date
First open the console using the key combination [Ctrl] + [Alt] + [T] or enter "Terminal" in the search bar. Linux differentiates between when you access the file (access), change its attributes (change) or change the file itself (modify). You cannot search for when you created the file.
- In the terminal, go to the directory in which the file is located.
- The general command is "find. -Iname". * File extension "-xtime xy".
- The period after the "find" indicates that Linux is looking in the current directory or subdirectories. The parameter "-iname" * .File extension "" limits the selection depending on the file type. For example, if you are looking for PDF files, replace the extension with "* .pdf".
- Depending on which files you are looking for, enter either -mtime, -atime or -ctime. The former only finds the files that were changed at the specified time. The "-atime" command sorts according to the time of access and "-ctime" outputs the objects whose attributes have changed on the date.
- Replace the "x" in the general command with a plus or a minus. Write "+ y", the console will output files older than y days. With "-y" you get the files that were changed less than y days ago, whereby the variable "y" describes the number of days.
- An example would be "find. -Iname" * .txt "-mtime -30". This will give you all the text files that were changed less than 30 days ago.
Another practical tip explains how to find large files under Linux.