How to Find Recent or Today’s Modified Files in Linux

In this article, we will explain two, simple command line tips that enable you to only list all today’s files.

One of the common problems Linux users encounter on the command line is locating files with a particular name, it can be much easier when you actually know the filename.

However, assuming that you have forgotten the name of a file that you created (in your home folder which contains hundreds of files) at an earlier time during the day and yet you need to use urgently.

Below are different ways of only listing all files that you created or modified (directly or indirectly) today.

1. Using the ls command, you can only list today’s files in your home folder as follows, where:

  1. -a – list all files including hidden files
  2. -l – enables long listing format
  3. --time-style=FORMAT – shows time in the specified FORMAT
  4. +%D – show/use date in %m/%d/%y format
# ls  -al --time-style=+%D | grep 'date +%D'
Find Recent Files in Linux
Find Recent Files in Linux

In addition, you can sort the resultant list alphabetically by including the -X flag:

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

You can also list based on size (largest first) using the -S flag:

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

2. Again, it is possible to use the find command which is practically more flexible and offers plenty of options than ls, for the same purpose as below.

  1. -maxdepth level is used to specify the level (in terms of sub-directories) below the starting point (current directory in this case) to which the search operation will be carried out.
  2. -newerXY, this works if timestamp X of the file in question is newer than timestamp Y of the file reference. X and Y represent any of the letters below:
    1. a – access time of the file reference
    2. B – birth time of the file reference
    3. c – inode status change time of reference
    4. m – modification time of the file reference
    5. t – reference is interpreted directly as a time

This means that, only files modified on 2016-12-06 will be considered:

# find . -maxdepth 1 -newermt "2016-12-06"
Find Today's Files in Linux
Find Today’s Files in Linux

Important: Use the correct date format as reference in the find command above, once you use a wrong format, you will get an error as the one below:

# find . -maxdepth 1 -newermt "12-06-2016"

find: I cannot figure out how to interpret '12-06-2016' as a date or time

Alternatively, use the correct formats below:

# find . -maxdepth 1 -newermt "12/06/2016"
OR
# find . -maxdepth 1 -newermt "12/06/16"
Find Todays Modified Files in Linux
Find Todays Modified Files in Linux

You can get more usage information for ls and find commands in our following series of articles on same.

  1. Master Linux ‘ls’ Command with This 15 Examples
  2. Useful 7 Quirky ‘ls’ Tricks for Linux Users
  3. Master Linux ‘find’ Command with This 35 Examples
  4. Ways to Find Multiple Filenames with Extensions in Linux

In this article, we explained two important tips of how to list only today’s files with the help of ls and find commands. Make use of the feedback form below to send us any question(s) or comments about the topic. You can as well inform us of any commands used for the same goal.

Hey TecMint readers,

Exciting news! Every month, our top blog commenters will have the chance to win fantastic rewards, like free Linux eBooks such as RHCE, RHCSA, LFCS, Learn Linux, and Awk, each worth $20!

Learn more about the contest and stand a chance to win by sharing your thoughts below!

Aaron Kili
Aaron Kili is a Linux and F.O.S.S enthusiast, an upcoming Linux SysAdmin, web developer, and currently a content creator for TecMint who loves working with computers and strongly believes in sharing knowledge.

Each tutorial at TecMint is created by a team of experienced Linux system administrators so that it meets our high-quality standards.

Join the TecMint Weekly Newsletter (More Than 156,129 Linux Enthusiasts Have Subscribed)
Was this article helpful? Please add a comment or buy me a coffee to show your appreciation.

16 Comments

Leave a Reply
  1. I would like to know a command that lists all files modified in the last 24 hours without using the find command.

    Reply
    • @Sebastian,

      If you want to list all files modified in the last 24 hours without using the find command, you can use a combination of ls, stat, and awk.

      ls -lR --time-style=+%Y-%m-%dT%H:%M:%S | awk -v now="$(date +%s)" '{if ($6 ~ /^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}$/) {cmd="date -d "$6" +%s"; cmd | getline filetime; if ((now - filetime) <= 86400) print $NF}}'

      Reply
  2. Does the check /etc directory have any new files created (compared to the last run)? If yes, display the file information and if it is a text file, display the first 10 lines of the file

    Reply
  3. I just need a GUI click that shows me download files starting most recently. Only need to do it once in a while. Thanks for all those that have given me complex command line info but I only need to do it once in a while and a click should do it.

    Reply
  4. Hi,

    Could anyone please help me?

    I want to track editing made in the last some days into my systems’ network interface file (ens192).

    Thanks and Regards,
    Shozib Javed

    Reply
    • @Vinod,

      To find all files under /etc that have been modified in the last 7 days, list them newest first.

      # find /etc -mtime -7 -type f -print0 | xargs -0 ls -al | sort -r +7
      Reply
  5. I ran some samples using: ls -al –time-style=+%D | grep ‘date +%D’
    but didn’t work for me.

    find seems to work a little better. see below

    [[email protected] home]$ find . -maxdepth 1 -newermt “2016-12-06”
    .
    ./DOMAIN
    ./python.py
    [[email protected] home]$ find . -maxdepth 1 -newermt “2016-12-07”
    .
    ./python.py

    Reply
    • @Jordi

      Both methods should work just fine, try to check the first command ls -al – – time-style=+%D | grep ‘date +%D’ and ensure that the spacing between the individual characters options is correct.

      However, you can always choose the method that works for you and above all, many thanks for the feedback.

      Reply

Got Something to Say? Join the Discussion...

Thank you for taking the time to share your thoughts with us. We appreciate your decision to leave a comment and value your contribution to the discussion. It's important to note that we moderate all comments in accordance with our comment policy to ensure a respectful and constructive conversation.

Rest assured that your email address will remain private and will not be published or shared with anyone. We prioritize the privacy and security of our users.