How do I find all the files that were created today in Unix/Linux?

后端 未结 11 560
梦谈多话
梦谈多话 2020-12-24 00:21

How do I find all the files that were create only today and not in 24 hour period in unix/linux

相关标签:
11条回答
  • 2020-12-24 01:02

    You can't. @Alnitak's answer is the best you can do, and will give you all the new files in the time period it's checking for, but -ctime actually checks the modification time of the file's inode (file descriptor), and so will also catch any older files (for example) renamed in the last day.

    0 讨论(0)
  • 2020-12-24 01:05

    I use this with some frequency:

    $ ls -altrh --time-style=+%D | grep $(date +%D)
    
    0 讨论(0)
  • 2020-12-24 01:09

    Use ls or find to have all the files that were created today.

    Using ls : ls -ltr | grep "$(date '+%b %e')"

    Using find : cd $YOUR_DIRECTORY; find . -ls 2>/dev/null| grep "$(date '+%b %e')"

    0 讨论(0)
  • 2020-12-24 01:16

    This worked for me. Lists the files created on May 30 in the current directory.

    ls -lt | grep 'May 30'
    
    0 讨论(0)
  • 2020-12-24 01:16

    You can use find and ls to accomplish with this:

    find . -type f -exec ls -l {} \; |  egrep "Aug 26";
    

    It will find all files in this directory, display useful informations (-l) and filter the lines with some date you want... It may be a little bit slow, but still useful in some cases.

    0 讨论(0)
提交回复
热议问题