Everything for the Ubuntu Server Administrator

User Tools

Site Tools


Server Administration

Server Applications

At the Command Line


Copyright 2013 Applied Conscious Technologies, LLC

Terms of Agreement


submit to reddit




project page:

s3cmd can upload, download, change attributes and otherwise manage data stored on Amazon S3.

Delete Stale S3 Objects


Install Package

sudo aptitude -y install s3cmd


You'll need to configure s3cmd so it can use your Amazon S3 account.

If you are going to run the backup script as root, then you need to configure s3cmd while logged in as root.

sudo -i
s3cmd --configure

You will need your S3 Access Key and Secret Access Key.

List Difference Between Local and S3 File Listings

If you need to see which files are difference between S3 and a local directory, this will create two lists and then compare those lists. You might need to do this to see which files need to be uploaded to S3, for example.

s3cmd ls s3://bucketnamehere/ |  awk '{print $4}' | awk -F/ '{print $NF}' | sed '/^$/d' >~/files-s3.txt
ls -1 /path-to-local/*  | awk -F/ '{print $NF}' >~/files-local.txt 
diff ~/file-s3.txt ~/files-local.txt

Uploading to S3 For CloudFront

To be served from CloudFront, a file needs to have a public read attribute and mime type set.

s3cmd put --acl-public --guess-mime-type filename-here s3://bucketname-here/

s3cmd.txt · Last modified: 2015/05/31 21:20 (external edit)