A Simple Guide to Managing Cloud Storage from the Command Line
If you work with S3-compatible storage - whether that’s AWS S3, Hetzner Object Storage, Wasabi, DigitalOcean Spaces, or Self‑hosted MinIO, you’ve probably hit moments where doing things through a web dashboard just isn’t cutting it. That’s where S3CMD comes in.s3cmd is a command-line tool that gives you full control over your buckets and files, right from your terminal. It’s powerful, flexible, and once you’ve set it up, you’ll never want to go back to point‑and‑click uploads.
Why S3CMD?
With a few keystrokes, s3cmd lets you:
- List, upload, move, and delete files in your storage
- Sync directories between your local machine and S3
- Generate presigned URLs you can share without exposing credentials
- Automate backups or file uploads with simple shell scripts
Getting Started
Once you’ve configured your credentials using s3cmd --configure, you can start running simple commands like these:
Pretty straightforward and faster than opening the console.
Moving, Uploading, and Downloading Files
Moving stuff around works just like you’d expect:
Uploading or downloading files is equally simple:
When you start dealing with large sets of data or automated backups, these few commands will save you hours.
Compressing Before You Upload
Here’s the thing - S3 doesn’t technically support folders. Everything is just keys and prefixes that look like folders. If you want to upload an entire set of directories neatly, it’s smart to archive them first.
Here’s a quick way to zip every folder and push them all up:
If you prefer .tar.gz for smaller size:
This trick keeps your uploads tidy and makes it easier to retrieve everything later.
Sharing Files: Presigned URLs
Want to share a file quickly? Instead of making your bucket public, generate a temporary download link:
You’ll get a URL that anyone can open in their browser without needing credentials. You can even batch-generate them:
Keeping Local and Remote Folders in Sync
Backup routines or local mirror setups are a breeze:
Quick Deletes (Use with Care!)
When cleaning up cluttered buckets, use del:
Pro tip: Always preview with s3cmd ls --recursive before a mass delete. One misplaced slash can ruin your week.
Power Tools & Tricks
Here are a few underrated commands worth learning:
Once you get comfortable chaining commands like this, you can manage massive datasets easily.
Aliases and Automation
To speed things up, add these shortcuts to your .bashrc or .zshrc:
Then just run s3upload myproject archives and it’ll package and upload automatically.
When Things Go Wrong
If something’s not working:
Common issues usually boil down to credentials, region mismatch, or endpoint URLs.
Final Thoughts
s3cmd is one of those tools that you learn once and then rely on constantly. Whether you’re deploying to object storage, archiving backups, or just keeping local and remote files in sync, it gives you total control, without ever leaving the terminal.
Pair it with a few shell scripts or cron jobs, and you’ve basically built yourself a mini cloud automation system.