The -daystart option measures the time from the start of the current day instead of 24 hours ago. $ find /home/james -iname "*.docx" -atime 20 -type -f The -daystart option Note that there's no minus sign before the 20 value. To view the docx files accessed precisely 20 days ago, run the command below. Find and sort files based on last modification time using ls command.
To list the files in reverse order, i.e oldest files first, use 'r' flag like below: ls -ltr. To view all text files in the home directory accessed within the last 30 days, run $ find /home/james -iname "*.txt" -atime -30 -type f To list the files of a specific directory based on modification time, type: ls -lt /Downloads/. -mtime 90 Means you are looking for a file modified exactly 90 days.įor example, to search for txt files in the /home/james/data directory that were modified less than 90 days ago use the following command: $ find /home/james/data -iname "*.txt" -mtime -90 -printĪdditionally, you can use numerical parameters as shown:įor example, the following command displays text files modified in the last 12 hours $ find /home/james/data -iname "*.txt" -mtime -0.5 Using atime - File accessĪs we have seen previously, atime is the attribute used for showing the last time a file was accessed by a user or an application.- mtime -90 Means that you are looking for a file changed less than 90 days ago.- mtime +90 Implies that you are looking for a file changed more than 90 days ago.To list files whose timestamp changed in the last 90 days use the + mtime 90 option. In this section, we will focus on how you can go about searching for files with timestamps that fall within a certain range using the mtime option. Here we will focus more on the ' atime and ' mtime' timestamps. That's a brief overview of the timestamps. The following command will enable you to display detailed information about a directory. Type ls -l chap1 -j as your format if you want to display detailed information. dot () lists all files in this directory.
A good example is modifying file ownership or permissions which effectively changes the timestamp. Lists all files in a single directory by typing ls -a. It reveals when the file's properties changed. 11 sijpkes, nissen-chris, fermisk, ahinvision, artoodeeto, bittelc, mike-bailey, Aanchal103, JamieKeeling, SurendraSisodia, and tensojka reacted with. I would love to hear anyone's ideas on the efficiency parts of the question, as I don't have one myself and am still curious.
Mmin: The mmin directive reveals the last time a file was modified in minutes.Ĭtime: This is the change time or change timestamp. The issue is labeled 'aws s3 ls - find files by modified date'.