s3cmd 常见用法
常见用法
-
列举所有 Buckets
$ s3cmd ls -
创建 bucket,且 bucket 名称是唯一的,不能重复。
s3cmd mb s3://my-bucket-name -
删除空 bucket
s3cmd rb s3://my-bucket-name -
列举 Bucket 中的内容
s3cmd ls s3://my-bucket-name -
上传 file.txt 到某个 bucket,
s3cmd put file.txt s3://my-bucket-name/file.txt -
上传并将权限设置为所有人可读
s3cmd put --acl-public file.txt s3://my-bucket-name/file.txt -
批量上传文件
s3cmd put ./* s3://my-bucket-name/ -
下载文件
s3cmd get s3://my-bucket-name/file.txt file.txt -
批量下载
s3cmd get s3://my-bucket-name/* ./ -
删除文件
s3cmd del s3://my-bucket-name/file.txt -
来获得对应的bucket所占用的空间大小
s3cmd du -H s3://my-bucket-name -
设置S3 bucket的Public权限
s3cmd setacl s3://myexamplebucket.calvium.com/ --acl-public --recursive
临时链接
s3cmd signurl s3://example-bucket/image.jpg 1657457538
- example-bucket — the name of the bucket that hosts the file,
- image.jpg — the file you want to share,
- 1657457538 — link expiry time in the Timestamp format, use the converter to convert time formats.