简体   繁体   English

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

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

对于Linux操作系统,如何过滤终端中ls命令的输出,只显示二月份创建的文件?

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

or 要么

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

You can simple grep the output to filter out only Feb files 您可以简单地grep输出以仅过滤掉Feb文件

ls -l | grep "Feb"

If you want to filter out files in the sub directories also then 如果你想过滤出子目录中的文件那么

ls -l -R | grep "Feb"

Note 注意

  • R flag means recursive R标志表示递归

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM