Linux shell - 按时间和文件大小排序显示文件

在工作中有这样的情况,需要显示所有的文件,按照时间先后或者文件大小先后排序显示

命令:ls

1.按时间排序显示文件

1
test @> ll -rt

2.按文件大小排序显示文件(文件大小单位:k,M)

1
test @> ll -Sh

参数的解释如下:

-r, --reverse              reverse order while sorting

 -t                         sort by modification time

-S                         sort by file size

 -h, --human-readable       with -l, print sizes in human readable format

                               (e.g., 1K 234M 2G)

 

转载自:https://www.cnblogs.com/recognition/p/5329992.html

猜你喜欢

转载自www.cnblogs.com/xibuhaohao/p/11420402.html