linux系統中如何將當前目錄下的文件從大到小排序和從小到大排序


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

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM