【linux】的文件按时间排序


> ls -alt # 按修改时间排序 > ls --sort=time -la # 等价于> ls -alt > ls -alc # 按创建时间排序 > ls -alu # 按访问时间排序 # 以上均可使用-r实现逆序排序 > ls -alrt # 按修改时间排序 > ls --sort=time -lra # 等价于> ls -alrt > ls -alrc # 按创建时间排序 > ls -alru # 按访问时间排序

实例:按文件生成时间倒序排列

[root@67 log]# ls -alt 总用量 92 drwxr-x---. 6 root root 4096 10月 14 15:55 .. drwxr-x---. 2 root root 4096 10月 14 15:55 . -rw-r-----  1 root root  896 10月 14 15:55 result-42.txt -rw-r-----  1 root root  602 10月 14 15:50 result-41.txt -rw-r-----  1 root root  896 10月 14 14:03 result-40.txt -rw-r-----  1 root root  898 10月 14 12:54 result-39.txt -rw-r-----  1 root root  896 10月 14 12:13 result-38.txt -rw-r-----  1 root root 1181 10月 14 08:54 result-37.txt -rw-r-----  1 root root 1178 10月 14 08:13 result-36.txt -rw-r-----  1 root root 1181 10月 13 22:54 result-35.txt -rw-r-----  1 root root 1178 10月 13 22:12 result-34.txt -rw-r-----  1 root root 1181 10月 13 12:54 result-33.txt -rw-r-----  1 root root 1178 10月 13 12:12 result-32.txt -rw-r-----  1 root root 1181 10月 13 08:54 result-31.txt -rw-r-----  1 root root 1178 10月 13 08:13 result-30.txt -rw-r-----  1 root root 1181 10月 12 22:54 result-29.txt -rw-r-----  1 root root 1178 10月 12 22:12 result-28.txt -rw-r-----  1 root root 1181 10月 12 12:54 result-27.txt -rw-r-----  1 root root 1178 10月 12 12:12 result-26.txt -rw-r-----  1 root root  898 10月 12 08:54 result-25.txt -rw-r-----  1 root root  896 10月 12 08:12 result-24.txt -rw-r-----  1 root root  898 10月 11 22:54 result-23.txt -rw-r-----  1 root root  896 10月 11 22:12 result-22.txt

 

参考文档:LINUX的文件按时间排序


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM