linux ls排序

葫芦的运维日志

下一篇 搜索 上一篇

浏览量 4829

2010/11/05 17:48


ls按最后访问时间排序:


➜  ~ ls -lhru
total 2880
drwxr-xr-x   4 brownwang  staff   128B Nov  5 11:54 txt
-rw-r--r--   1 brownwang  staff   1.3M Nov  1 15:19 test.mp4
-rw-r--r--@  1 brownwang  staff   351B Nov  5 16:52 tcm.py
-rw-r--r--@  1 brownwang  staff   349B Nov  5 16:52 tcls.py
-rw-r--r--   1 brownwang  staff   348B Oct 16 11:46 package.json
drwxr-xr-x  53 brownwang  staff   1.7K Nov  4 17:21 node_modules
drwxr-xr-x  10 brownwang  staff   320B Nov  4 17:23 log
drwxr-xr-x   5 brownwang  staff   160B Nov  5 17:48 code
-rw-r--r--   1 brownwang  staff   119K Oct 21 04:47 a.txt
-rw-r--r--   1 brownwang  staff    17B Nov  4 16:13 a
drwxr-xr-x+  4 brownwang  staff   128B Nov  4 17:23 Public
drwx------+  3 brownwang  staff    96B Nov  4 17:23 Pictures
drwx------+  5 brownwang  staff   160B Nov  4 17:23 Music
drwx------+  3 brownwang  staff    96B Nov  4 17:23 Movies
drwx------@ 64 brownwang  staff   2.0K Nov  5 15:16 Library
drwx------+ 83 brownwang  staff   2.6K Nov  5 17:48 Downloads
drwx------+ 13 brownwang  staff   416B Nov  5 15:46 Documents
drwx------+ 11 brownwang  staff   352B Nov  4 17:23 Desktop

ls按最后修改时间排序:

➜  ~ ls -lhrt
total 2880
drwxr-xr-x+  4 brownwang  staff   128B Oct 15 10:50 Public
drwx------+  3 brownwang  staff    96B Oct 15 10:50 Pictures
drwx------+  3 brownwang  staff    96B Oct 15 10:50 Movies
-rw-r--r--   1 brownwang  staff   348B Oct 16 11:46 package.json
drwxr-xr-x  53 brownwang  staff   1.7K Oct 16 11:47 node_modules
drwxr-xr-x  10 brownwang  staff   320B Oct 18 11:16 log
-rw-r--r--   1 brownwang  staff   119K Oct 18 21:01 a.txt
drwxr-xr-x   5 brownwang  staff   160B Oct 21 01:03 code
drwxr-xr-x   4 brownwang  staff   128B Oct 22 14:50 txt
drwx------+ 11 brownwang  staff   352B Oct 23 23:17 Desktop
drwx------+  5 brownwang  staff   160B Oct 26 19:30 Music
-rw-r--r--   1 brownwang  staff   1.3M Nov  1 15:19 test.mp4
drwx------@ 64 brownwang  staff   2.0K Nov  1 19:13 Library
drwx------+ 13 brownwang  staff   416B Nov  2 11:49 Documents
-rw-r--r--   1 brownwang  staff    17B Nov  4 16:13 a
-rw-r--r--@  1 brownwang  staff   349B Nov  4 17:20 tcls.py
-rw-r--r--@  1 brownwang  staff   351B Nov  4 17:30 tcm.py
drwx------+ 83 brownwang  staff   2.6K Nov  5 17:43 Downloads

ls按文件创建时间排序:

➜  ~ ls -lhtrc
total 2880
drwx------+  3 brownwang  staff    96B Oct 15 10:50 Pictures
drwxr-xr-x+  4 brownwang  staff   128B Oct 15 10:50 Public
drwx------+  3 brownwang  staff    96B Oct 15 10:50 Movies
-rw-r--r--   1 brownwang  staff   348B Oct 16 11:46 package.json
drwxr-xr-x  53 brownwang  staff   1.7K Oct 16 11:47 node_modules
drwxr-xr-x  10 brownwang  staff   320B Oct 18 11:16 log
-rw-r--r--   1 brownwang  staff   119K Oct 18 21:01 a.txt
drwxr-xr-x   5 brownwang  staff   160B Oct 21 01:03 code
drwxr-xr-x   4 brownwang  staff   128B Oct 22 14:50 txt
drwx------+ 11 brownwang  staff   352B Oct 23 23:17 Desktop
drwx------+  5 brownwang  staff   160B Oct 26 19:30 Music
-rw-r--r--   1 brownwang  staff   1.3M Nov  1 15:19 test.mp4
drwx------@ 64 brownwang  staff   2.0K Nov  1 19:13 Library
drwx------+ 13 brownwang  staff   416B Nov  2 11:49 Documents
-rw-r--r--   1 brownwang  staff    17B Nov  4 16:13 a
-rw-r--r--@  1 brownwang  staff   349B Nov  4 17:21 tcls.py
-rw-r--r--@  1 brownwang  staff   351B Nov  4 17:30 tcm.py
drwx------+ 83 brownwang  staff   2.6K Nov  5 17:43 Downloads
-rw-r--r--   1 brownwang  staff     0B Nov  5 17:57 1.txt

ls按文件大小排序:

➜  ~ ls -lhrS
total 2880
-rw-r--r--   1 brownwang  staff    17B Nov  4 16:13 a
drwx------+  3 brownwang  staff    96B Oct 15 10:50 Pictures
drwx------+  3 brownwang  staff    96B Oct 15 10:50 Movies
drwxr-xr-x   4 brownwang  staff   128B Oct 22 14:50 txt
drwxr-xr-x+  4 brownwang  staff   128B Oct 15 10:50 Public
drwxr-xr-x   5 brownwang  staff   160B Oct 21 01:03 code
drwx------+  5 brownwang  staff   160B Oct 26 19:30 Music
drwxr-xr-x  10 brownwang  staff   320B Oct 18 11:16 log
-rw-r--r--   1 brownwang  staff   348B Oct 16 11:46 package.json
-rw-r--r--@  1 brownwang  staff   349B Nov  4 17:20 tcls.py
-rw-r--r--@  1 brownwang  staff   351B Nov  4 17:30 tcm.py
drwx------+ 11 brownwang  staff   352B Oct 23 23:17 Desktop
drwx------+ 13 brownwang  staff   416B Nov  2 11:49 Documents
drwxr-xr-x  53 brownwang  staff   1.7K Oct 16 11:47 node_modules
drwx------@ 64 brownwang  staff   2.0K Nov  1 19:13 Library
drwx------+ 83 brownwang  staff   2.6K Nov  5 17:43 Downloads
-rw-r--r--   1 brownwang  staff   119K Oct 18 21:01 a.txt
-rw-r--r--   1 brownwang  staff   1.3M Nov  1 15:19 test.mp4

 

葫芦的运维日志

打赏

上一篇 搜索 下一篇
© 冰糖葫芦甜(bthlt.com) 2021 王梓打赏联系方式 陕ICP备17005322号-1