Linux 如何过滤ls命令的输出以仅显示2月份创建的文件?
对于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
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标志表示递归
ls -l -R | grep "Feb"