我使用find命令在bash中查找某些类型的文件.一切顺利,显示给我的结果只包含文件名但不包含文件的(最后修改)日期.我试图将它管道输入ls或ls -ltr但它只是没有显示结果中的提交列,我也试过这个:
ls -ltr | find . -ctime 1
Run Code Online (Sandbox Code Playgroud)
但实际上我没有工作.能否指导我如何查看find命令返回的文件的归档?
您需要xargs或-exec为此:
find . -ctime 1 -exec ls -l {} \;
find . -ctime 1 | xargs ls -l
Run Code Online (Sandbox Code Playgroud)
(第一个ls单独执行每个找到的文件,第二个将它们组合成一个或多个大ls调用,以便它们可以稍微更好地格式化.)
如果您只想显示类似输出的ls,您可以使用-lsfind选项:
$ find . -name resolv.conf -ls
1048592 8 -rw-r--r-- 1 root root 126 Dec 9 10:12 ./resolv.conf
Run Code Online (Sandbox Code Playgroud)
如果您只想要时间戳,则需要查看该-printf选项
$ find . -name resolv.conf -printf "%a\n"
Mon May 21 09:15:24 2012
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
10490 次 |
| 最近记录: |