微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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

 

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。