How to Find Recently Modified Files in Linux?

Here we are going to see how to find recent or today’s modified files in Linux. Locating files with a particular name is one of the problems Linux user’s faces, it would be easier when you actually know the filename.

let’s assume that you have created a file in your home folder and you have forgotten the name of the file which also contains some more files and now you want to use it then below are the ways of listing all files that you created or modified today.

Method 1: Using stat command.

Stat command can be used to display timestamps of a file.

Syntax :

stat [File_Name]

Example 2: Using the ls command.

By using this command you can list only today’s files in your home folder.

Syntax :

# ls  -al --time-style=+%D | grep 'date +%D'

Where:

  • -a – lists all files(including hidden files)
  • -l – enables listing format
  • –time-style=FORMAT – shows time in the specified FORMAT
  • +%D – show/use date in %m/%d/%y format

If you want to list the files which are sorted alphabetically.

Syntax :

# ls -alX --time-style=+%D | grep 'date +%D'

If you want to list the files based on size.

Syntax :

# ls -alS --time-style=+%D | grep 'date +%D'

Example 3: Using the find command

Syntax :

# find . -maxdepth 1 -newermt "date"

Date format yyyy-dd-mm.

  • -maxdepth level is used to specify the level
  • -newerPQ, if timestamp P of the file is newer than timestamp Q of the file reference. P and Q may represent any of the letters below
  • a – access time of the file reference
  • B – birth time of the file reference
  • c – inode status change time of reference
  • m – modification time of the file reference
  • t – reference is interpreted directly as a time


Contact Us