The Linux operating system has some very powerful and effective tools to help make your computing experience less stressful. One of these more useful commands is the “find” application. This command can be used to find files located all over your hard drive. The ability to narrow that search using parameters, such as when files were last accessed or created within a specified range of dates is helpful. This is because you may not remember the file name, or you need to find files that were very recently accessed.
So how do you go about finding files based on dates? Here is a quick look at how easy it is:
You will need to work from the Linux command line, so open your terminal window. These include gnome-terminal, Konsole, and xterm, depending on the type of Linux distribution you are using.
Go to the highest directory you wish the search performed on. This is a simple “cd ” command. Using a specific directory to search will increase the speed of the search process.
Decide on what your search terms and criteria are. You can include such things as how many days back they were accessed (atime), when the data was actually changed (mtime), and attribute changes (ctime).
Simply run the find command with something similar to “find . mtime -print” The command will search for files within the chosen directory as well as its subdirectories. It will then display the results (-print command provides this).
Using this “find” command can be implemented however you wish. Say, for instance, you want to find directories or files that were changed more than four days prior, you would enter “find . –mtime +4 –print”. This command translates to finding files and directores that were last accessed more than one day prior, but less than four days ago.