如何过滤 ls 命令的输出以仅显示二月份创建的文件?

How to filter the output of ls command to display only files created in February?

对于Linux OS,如何在终端中过滤 ls 命令的输出以仅显示 2 月创建的文件?

touch --date "yyyy-mm-dd" /tmp/start
touch --date "yyyy-mm-dd" /tmp/end
find /my/path -type f -newer /tmp/start -not -newer /tmp/end

ls -l  | grep 'yyyy-mm-dd'

您可以简单地 grep 输出以仅过滤掉 Feb 文件

ls -l | grep "Feb"

如果你也想过滤掉子目录中的文件那么

ls -l -R | grep "Feb"

备注

  • R标志表示递归