1、創建5個測試數據文件
[root@centos7 test]# dd if=/dev/zero bs=1M count=100 of=a.txt [root@centos7 test]# dd if=/dev/zero bs=1M count=10 of=b.txt [root@centos7 test]# dd if=/dev/zero bs=1M count=1 of=c.txt [root@centos7 test]# dd if=/dev/zero bs=1M count=150 of=d.txt [root@centos7 test]# dd if=/dev/zero bs=1M count=50 of=e.txt
2、將當前目錄下的文件從大到小排序
[root@centos7 test]# ls -S | xargs du -sh
3、將當前目錄下的文件從小到大排序
[root@centos7 test]# ls -S | xargs du -sh |tac