Operation
s3cmd

s3cmd

Function description

S3cmd is a free command-line tool used to upload, retrieve, and manage data using the S3 protocol. It is most suitable for users familiar with command-line programs and is widely used in batch scripts and automatic backups.

Installation and usage

Applicable operating systems: Linux, MacOS, Windows

Installation steps

1.Download the installation package
https://s3tools.org/download. Here, we take the current latest version 2.1.0 as an example.
2.Extract the installation package
tar xzvf s3cmd-2.1.0.tar.gz
3.Move the directory
mv s3cmd-2.1.0 /usr/local/s3cmd
4.Create a soft connection
ln -s /usr/local/s3cmd/s3cmd /usr/bin/s3cmd (You can use sudo if you don't have sufficient permissions)
5.Execute the configuration command and fill in the necessary information (you can also skip it directly and fill it in manually in the next step)
s3cmd --configure
6.Fill in the configuration
vim ~/.s3cfg
Open the current configuration and fill in the following parameters:
access_key = "TOKEN public key/API public key"
secret_key = "TOKEN private key/API private key"
host_base = "s3 protocol domain name, like: *.s3-us-ca.s3stor.runc.ai"
host_bucket = "request style, like: %(bucket)s.s3-us-ca.s3stor.runc.ai"
multipart_chunk_size_mb = 8 "The supported S3 protocol segmentation size for US3 is 8M, so only 8 can be filled in here"

Example configuration items

[default]
access_key = "TOKEN_xxxxxxxxx"
access_token =
add_encoding_exts =
add_headers =
bucket_location = US
check_ssl_certificate = True
check_ssl_hostname = True
connection_pooling = True
content_disposition =
content_type =
default_mime_type = binary/octet-stream
delay_updates = False
delete_after = False
delete_after_fetch = False
delete_removed = False
dry_run = False
enable_multipart = True
encrypt = False
expiry_date =
expiry_days =
expiry_prefix =
follow_symlinks = False
force = False
get_continue = False
gpg_passphrase =
guess_mime_type = True
host_base = s3-us-ca.s3stor.runc.ai
host_bucket =%(bucket)s.s3-us-ca.s3stor.runc.ai
human_readable_sizes = False
invalidate_default_index_on_cf = False
invalidate_default_index_root_on_cf = True
invalidate_on_cf = False
kms_key =
limit = -1
limitrate = 0
list_md5 = False
log_target_prefix =
long_listing = False
max_delete = -1
mime_type =
multipart_chunk_size_mb = 8
multipart_max_chunks = 10000
preserve_attrs = True
progress_meter = True
proxy_host =
proxy_port = 80
public_url_use_https = False
put_continue = False
recursive = False
recv_chunk = 65536
reduced_redundancy = False
requester_pays = False
restore_days = 1
restore_priority = Standard
secret_key = "xxxxxxxxxxxxxxxxxxx"
send_chunk = 65536
server_side_encryption = False
signature_v2 = False
signurl_use_https = False
simpledb_host = sdb.amazonaws.com
skip_existing = False
socket_timeout = 300
stats = False
stop_on_error = False
storage_class =
throttle_max = 100
upload_id =
urlencoding_mode = normal
use_http_expect = False
use_https = False
use_mime_magic = True
verbosity = WARNING
website_index = index.html

Usage

1.Upload a file
s3cmd put test.txt s3://bucket1
2.Delete a file
s3cmd del s3://bucket1/test.txt
3.Download a file
s3cmd get s3://bucket1/test.txt
4.Copy a file
s3cmd cp s3://bucket1/test.txt s3://bucket2/test.txt
Other common operations
1.Upload a folder
s3cmd put -r ./dir s3://bucket1/dir1
2.Download a folder
s3cmd get -r s3://bucket1/dir1 ./dir1
3.Delete a folder
s3cmd del s3://bucket1/dir1
Copyright © 2025 RunC.AI All rights reserved.