Viewing only the files created today on a Linux system

I sometimes need to see only the files created or modified today in a directory. On a Linux system, you can pipe the output of the ls command into the grep command looking for just today's date in the input to the grep command as shown below:

$ ls -al --time-style=+%D ~/Documents/*.zip | grep $(date +%D)
-rw-r--r--. 1 joe joe   269338 01/12/18 /home/joe/Documents/gloves.zip
$

You can specify how the date is displayed with +format where format is a particular format in which you want the date displayed - see Formatting the output from the date command on a Linux system. If you use +%D, the date will be displayed as m/d/y, i.e., month/day/year, e.g. 01/12/18 for January 12, 2018. By then using the grep command to search for that value, you can limit the displayed files to only those created or modified today.

Alternatively, you can use the find command with the newermt option as shown below to display only those files created or modified today - see Finding files modified today.

$ find ~/Documents -maxdepth 1 -type f -newermt 2018-01-12
/home/joe/Documents/gloves.zip
$

In this case, today is January 12, 2018, so I specify today's date with the -newermt option to display only the files created/modified on or after that date, i.e., today. The find command is looking at the modification time, but if a file was created today, it was obviously last modified today. By adding the -maxdepth 1 option, I only look in the top level directory and not subdirectories. If I omit that option, all subdirectories beneath the specified directory will also be checked. By adding -type f, I specify that I only want to see files created/modified today. If I omitted that option, I would also see any directories created or modified today.

You can also use the find command to find those files created or modified within the last 24 hours with the -mtime -1 as shown below:

$ find ~/Documents -maxdepth 1 -type f -mtime -1
/home/jim/Documents/coats.zip
/home/jim/Documents/gloves.zip
$

You can also use -daystart with -mtime -1 to see only the files created or modified today. But you need to put the -daystart option prior to the -mtime -1 option to measure time from the beginning of today rather than the last 24 hours as you would get with -mtime -1 alone.

$ ls -al ~/Documents/*.zip
-rw-rw-r--. 1 joe joe 1297732 Jan 11 23:00 /home/joe/Documents/coats.zip
-rw-rw-r--. 1 joe joe  269338 Jan 12 22:14 /home/joe/Documents/gloves.zip
-rw-rw-r--. 1 joe joe  483364 Jan 10 11:00 /home/joe/Documents/hats.zip
$ find ~/Documents -maxdepth 1 -type f -mtime -1
/home/joe/Documents/coats.zip
/home/joe/Documents/gloves.zip
$ find ~/Documents -maxdepth 1 -type f -mtime -1 -daystart
/home/joe/Documents/coats.zip
/home/joe/Documents/gloves.zip
$ find ~/Documents -maxdepth 1 -type f -daystart -mtime -1
/home/joe/Documents/gloves.zip
$