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

Linux 如何过滤ls命令的输出以仅显示2月份创建的文件?,linux,terminal,ls,superuser,Linux,Terminal,Ls,Superuser,对于Linux操作系统,如何在终端中过滤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 或 您可以对输出进行简单的grep处理,以仅过滤出Feb文件 ls -l | grep "Feb" 如果你想过滤掉子目录中的文件,那么 ls -l

对于Linux操作系统,如何在终端中过滤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


您可以对输出进行简单的grep处理,以仅过滤出Feb文件

ls -l | grep "Feb"
如果你想过滤掉子目录中的文件,那么

ls -l -R | grep "Feb"
注意

  • R标志表示递归

这是一个与超级用户相关的话题。试试这个:查找文件夹_name-type f-ls | grep'Feb',虽然它与超级用户相关,但这个问题有很多答案。我会选择ls-l<代码>| grep Feb。我添加了问号,因为这将设置您的时间。在这里,您可以根据修改时间、创建时间等进行打印。阅读手册页由您决定。
ls -l -R | grep "Feb"