【发布时间】:2019-11-28 11:22:52
【问题描述】:
我需要在匹配 3.0 MB 的目录中找到最近修改的文件。
第一次尝试
ls -t /home/weather/some.cool*.file | head -n +1 | grep "3.0M"
第二次尝试
find /home/weather/ -maxdepth 1 -type f -name "some.cool*.file" -size 3M -exec ls -t "{}" +; | head -n +1
我接近了吗?
【问题讨论】:
-
你试过
ls -lh --sort=time | grep "3.0M"吗? -
在我将
| head -n =1添加到末尾后效果很好。请提交此评论作为答案。 -
请务必查看
man页面,在那里可以找到很多有用的信息。man lsls的手册页