Digital Marketing

How to calculate sum size of files

 For example, sum size of all MySQL bin log files:

$ sudo du -cb /var/lib/mysql/mysql-bin.* | awk 'END{print $1}'

704384831090

option -b will display each file in bytes and -c will print the total size.

To calculate a specific date, such as Jul 1st:

 $ sudo ls -l /var/lib/mysql/mysql-bin.*  | grep "Jul 1" | awk '{print $9}' | xargs du -cb | awk 'END{print $1}'

605065048493


Comments

Popular posts from this blog

MySQL Sandbox with the Sakila sample database