Linux按创建日期和给定文件名组合排序文件 [英] Linux combine sort files by date created and given file name
本文介绍了Linux按创建日期和给定文件名组合排序文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要将它们结合到命令中,以便按指定的文件名"创建按日期排序的列表.
I need to combine these to commands in order to have a sorted list by date created with the specified "filename".
我知道按日期对文件进行排序可以通过以下方式实现:
I know that sorting files by date can be achieved with:
ls -lrt
ls -lrt
并使用
查找. -name文件名*"
find . -name "filename*"
我不知道如何将两者结合起来.我尝试使用管道,但没有得到正确的结果.
I don't know how to combine these two. I tried with a pipeline but I don't get the right result.
未排序
推荐答案
find . -name "filename" -printf '%TY:%Tm:%Td %TH:%Tm %h/%f\n' | sort
忘记xargs. 查找"和排序"是您所需的全部工具.
Forget xargs. "Find" and "sort" are all the tools you need.
这篇关于Linux按创建日期和给定文件名组合排序文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文