Linux / UNIX: Displaying Today’s Files Only

How do I list all files created today only using shell command under UNIX or Linux operating systems?

You can use the find command as follows to list today’s file in current directory only (i.e. no subdirs):
find -maxdepth 1 -type f -mtime -1
Sample outputs:

./.gtk-bookmarks
./.ICEauthority
./.bash_history
./.xsession-errors.old
./.xsession-errors
./.recently-used.xbel
./.dmrc

In this example, find todays directories only
find -maxdepth 1 -type d -mtime -1
Another old but outdated ls command hack is as follows:
ls -al --time-style=+%D | grep $(date +%D)
See the find command man page for more details:
man find

Posted by: SXI ADMIN

The author is the creator of SXI LLC and a seasoned sysadmin, DevOps engineer, and a trainer for the Linux operating system/Unix shell scripting. Get the latest tutorials on SysAdmin, Linux/Unix and open source topics via RSS/XML feed or weekly email newsletter.