Linux ls 命令按时间排序文件(正序、倒序)
文章目录
命令
按修改时间倒序排列,得到前10个文件
ll -t | head -10
按修改时间正序排列,得到前10个文件
ll -rt | head -10
通过man ls
可以知道
-t
表示: Sort by descending time modified (most recently modified first). If two files have the same modification timestamp, sort their names in ascending lexicographical order.
-s
表示: Reverse the order of the sort.
类推
按文件大小倒序排序文件
ll -Sh | head -10
-S
表示: Sort by size (largest file first) before sorting the operands in lexicographical order.
文章作者 pengxiaochao
上次更新 2025-02-27
许可协议 不允许任何形式转载。