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