linux系统中统计指定类型文件大小的总和


 

1、测试数据

[root@centos7 test2]# ll -h total 1.4G -rw-r--r--. 1 root root  41M Apr 15 09:47 a.map -rw-r--r--. 1 root root 204M Apr 15 09:47 a.ped -rw-r--r--. 1 root root  61M Apr 15 09:48 b.map -rw-r--r--. 1 root root 407M Apr 15 09:47 b.ped -rw-r--r--. 1 root root 611M Apr 15 09:47 c.ped -rw-r--r--. 1 root root  21M Apr 15 09:44 result.map

 

2、统计*.map文件的大小

[root@centos7 test2]# ls *.map | xargs du -ch 41M a.map 61M b.map 21M result.map 121M total [root@centos7 test2]# ls *.map | xargs du -ch | tail -n 1 121M total

 

ped

[root@centos7 test2]# ls *.ped | xargs du -h 204M a.ped 407M b.ped 611M c.ped [root@centos7 test2]# ls *.ped | xargs du -ch 204M a.ped 407M b.ped 611M c.ped 1.2G total [root@centos7 test2]# ls *.ped | xargs du -ch | tail -n 1
1.2G    total

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM