linuxls命令的重要用法:按照文件大小排序和按照时间排序 |
您所在的位置:网站首页 › linuxls › linuxls命令的重要用法:按照文件大小排序和按照时间排序 |
linuxls 命令的重要⽤法:按照⽂件⼤⼩排序和按照时间排序 1.ls 命令是 list 的缩写,⽤来打印当前⽬录清单或者打印出指定⽬录下的⽂件及⽂件清单。 2. 本⽂介绍 ls 的重要⽤法:按 “ ⽂件⼤⼩ ” 排序列出⽂件清单和按 “ 时间 ” 排序列出⽂件清单。 3. 按 “ ⽂件⼤⼩ ” 排序列出⽂件清单。 #-S 以⽂件的⼤⼩进⾏降序排序 [root@node5 ~]# ls -alSh /root/ total 1.4G -rw-r--r-- 1 root root 802M Aug 4 09:06 linux-4.19.77.tar -rw-r--r-- 1 root root 393M Aug 4 09:06 qemu-4.1.0.tar -rw-r--r-- 1 root root 183M May 2 2019 jdk-8u172-linux-x64.tar.gz -rw-r--r-- 1 root root 9.6M Aug 4 09:05 glibc-aarch64-linux-gnu-2.24-2.sdl7.2.noarch.rpm ...... #-S 以⽂件的⼤⼩进⾏升序排序 [root@node5 opt]# ls -lSrh total 136K drwxr-xr-x 3 root root 19 Nov 3 16:21 usr drwxr-xr-x 11 root root 151 Apr 22 2020 nginx drwxr-xr-x 10 root root 174 May 7 2019 apache-tomcat-8.0.51 -rw-r--r-- 1 root root 22K Oct 9 16:48 xfsdump_shadow -rw-r--r-- 1 root root 23K Oct 10 01:09 sdb6_incredump2 -rw-r--r-- 1 root root 23K Oct 10 01:06 sdb6_incredump1 -rw-r--r-- 1 root root 24K Oct 9 16:41 xfsdump_sdb6 -rw-r--r-- 1 root root 45K Oct 10 01:02 sdb6_fulldump 4. 按 “ 时间 ” 排序列出⽂件清单。 #-t 按时间排序 ,-r 从⼩到⼤,不加 r 由⼤到⼩ #-r 是 reverse 的简写,表⽰反转 [root@node5 opt]# ls -ltr total 136 drwxr-xr-x 10 root root 174 May 7 2019 apache-tomcat-8.0.51 drwxr-xr-x 11 root root 151 Apr 22 2020 nginx -rw-r--r-- 1 root root 23944 Oct 9 16:41 xfsdump_sdb6 -rw-r--r-- 1 root root 22416 Oct 9 16:48 xfsdump_shadow -rw-r--r-- 1 root root 46048 Oct 10 01:02 sdb6_fulldump -rw-r--r-- 1 root root 23504 Oct 10 01:06 sdb6_incredump1 -rw-r--r-- 1 root root 23280 Oct 10 01:09 sdb6_incredump2 drwxr-xr-x 3 root root 19 Nov 3 16:21 usr [root@node5 opt]# ls -ltrh total 136K drwxr-xr-x 10 root root 174 May 7 2019 apache-tomcat-8.0.51 drwxr-xr-x 11 root root 151 Apr 22 2020 nginx -rw-r--r-- 1 root root 24K Oct 9 16:41 xfsdump_sdb6 -rw-r--r-- 1 root root 22K Oct 9 16:48 xfsdump_shadow -rw-r--r-- 1 root root 45K Oct 10 01:02 sdb6_fulldump -rw-r--r-- 1 root root 23K Oct 10 01:06 sdb6_incredump1 -rw-r--r-- 1 root root 23K Oct 10 01:09 sdb6_incredump2 drwxr-xr-x 3 root root 19 Nov 3 16:21 usr |
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |