1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

[Linux] Count the total size of special files

Posted at

If you want to count the total size of special files. For example if you want to calculate the total size of files which name includes "daily". Then you can use this command to get the result.

find . -name "*daily*" | xargs du -ch

This will list all the files which name includes "daily" and count the total size of these files.

The output will like this:

4.0K	./2016_06_28_daily.log
4.0K	./2016_06_29_daily.log
4.0K	./2016_06_30_daily.log
4.0K	./2016_07_01_daily.log
4.0K	./2016_07_02_daily.log
4.0K	./2016_07_03_daily.log
 24K	total

If you have some better methods, please tell me :)

1
1
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?