How to summarize file space usage on Amazon S3 using command line client

Use s3cmd Command Line S3 Client and Backup for Linux and Mac to display disk usage on a particular bucket.

Install s3cmd package.

$ sudo apt-get install s3cmd

Provide encryption options, access and secret keys.

$ s3cmd --configure

Display cumulative size of particular files on personal-bucket in bytes.

$ s3cmd du s3://personal-bucket/backup/safeguard-*
28361660 s3://personal-bucket/backup/safeguard-*

Display cumulative size of particular files on personal-bucket in human readable format.

$ s3cmd du -H s3://personal-bucket/backup/safeguard-*
27M s3://personal-bucket/backup/safeguard-*
Milosz Galazka's Picture

About Milosz Galazka

Milosz is a Linux Foundation Certified Engineer working for a successful Polish company as a system administrator and a long time supporter of Free Software Foundation and Debian operating system.

Gdansk, Poland https://sleeplessbeastie.eu