• 【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的文件按时间排序

  • 相关阅读:
    影响指令流水线的因素
    硬布线控制器和微程序控制器 
    总线仲裁
    计算机专业面试
    P、NP、NPC、NPH问题的区别和联系
    多态
    软件生命周期
    你所不知道的js的小知识点(1)
    html span标签 不换行(有时span带中文时候是可以自动换行的)
    form的onsubmit事件--表单提交前的验证最佳实现方式
  • 原文地址:https://www.cnblogs.com/kaerxifa/p/11672100.html
Copyright © 2020-2023  润新知