zoukankan      html  css  js  c++  java
  • 【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的文件按时间排序

  • 相关阅读:
    Linux开机自启配置
    django 无限层级的评论
    nginx通过自定义header属性来转发不同的服务
    Python 读取excel指定的列
    python 全栈开发,Day86(上传文件,上传头像,CBV,python读写Excel,虚拟环境virtualenv)
    Python 判断字符串是否包含中文
    PMM--简介与部署
    Logrotate滚动openresty日志
    promethus监控mysql
    promethus监控nginx
  • 原文地址:https://www.cnblogs.com/kaerxifa/p/11672100.html
Copyright © 2011-2022 走看看