s3cmd(1)

๐Ÿ“ฆ
version 2.4.0 ยท 3 versions
, in alpine 3.24, arch rolling, debian trixie, epel 10, epel 9, fedora 43, fedora 44, nixos 26.05, nixpkgs unstable, ubuntu noble, ubuntu resolute, ubuntu stonking

s3cmd(1) โ€” the manual, but make it make sense ๐Ÿ’…

okay bestie, so this is the manual page for s3cmd(1). It's giving "General Commands Manual" energy, but we're gonna make it fun. No cap. โœจ

๐ŸŒธ NAME ๐ŸŒธ

s3cmd โ€” tool for managing Amazon S3 storage space and Amazon CloudFront content delivery network. It's literally your bestie for cloud stuff. ๐Ÿ’–

โœจ SYNOPSIS โœจ

s3cmd [OPTIONS] COMMAND [PARAMETERS]

๐Ÿ’– DESCRIPTION ๐Ÿ’–

okay so s3cmd is a command line client for copying files to/from Amazon S3 (Simple Storage Service) and performing other related tasks โ€” for instance creating and removing buckets, listing objects, etc. It's giving main character energy for your terminal. ๐Ÿฆ‹

๐ŸŽ€ COMMANDS ๐ŸŽ€

s3cmd can do several actions specified by the following commands. Let's go through them, bestie. ๐Ÿ’…

  • s3cmd mb s3://BUCKET โ€” Make bucket. Slay! ๐Ÿ’–
  • s3cmd rb s3://BUCKET โ€” Remove bucket. Bye bestie! ๐Ÿ‘‹
  • s3cmd ls [s3://BUCKET[/PREFIX]] โ€” List objects or buckets. Vibe check your stuff. โœจ
  • s3cmd la โ€” List all object in all buckets. The way that it lists everything? Obsessed. ๐Ÿ˜ญ
  • s3cmd put FILE [FILE...] s3://BUCKET[/PREFIX] โ€” Put file into bucket. Upload that content. ๐Ÿ”ฅ
  • s3cmd get s3://BUCKET/OBJECT LOCAL_FILE โ€” Get file from bucket. Download it, periodt. ๐Ÿ’…
  • s3cmd del s3://BUCKET/OBJECT โ€” Delete file from bucket. Not me deleting my problems. ๐Ÿ’€
  • s3cmd rm s3://BUCKET/OBJECT โ€” Delete file from bucket (alias for del). Same energy, different name. ๐Ÿ™ˆ
  • s3cmd restore s3://BUCKET/OBJECT โ€” Restore file from Glacier storage. Bring it back to life. ๐Ÿงš
  • s3cmd sync LOCAL_DIR s3://BUCKET[/PREFIX] or s3://BUCKET[/PREFIX] LOCAL_DIR or s3://BUCKET[/PREFIX] s3://BUCKET[/PREFIX] โ€” Synchronize a directory tree to S3 (checks files freshness using size and md5 checksum, unless overridden by options, see below). It's giving sync queen. ๐Ÿ‘‘
  • s3cmd du [s3://BUCKET[/PREFIX]] โ€” Disk usage by buckets. Check how much space you're taking up, bestie. ๐Ÿ“
  • s3cmd info s3://BUCKET[/OBJECT] โ€” Get various information about Buckets or Files. The tea. โ˜•
  • s3cmd cp s3://BUCKET1/OBJECT1 s3://BUCKET2[/OBJECT2] โ€” Copy object. Duplicate that vibe. โœจ
  • s3cmd modify s3://BUCKET1/OBJECT โ€” Modify object metadata. Change it up. ๐Ÿ’…
  • s3cmd mv s3://BUCKET1/OBJECT1 s3://BUCKET2[/OBJECT2] โ€” Move object. Shift it. ๐Ÿฆ‹
  • s3cmd setacl s3://BUCKET[/OBJECT] โ€” Modify Access control list for Bucket or Files. Who can see what? ๐Ÿ‘€
  • s3cmd setversioning s3://BUCKET enable|disable โ€” Modify Bucket Versioning. Keep track of versions, no cap. ๐Ÿ”„
  • s3cmd setownership s3://BUCKET BucketOwnerPreferred|BucketOwnerEnforced|ObjectWriter โ€” Modify Bucket Object Ownership. Who owns it? ๐Ÿ’
  • s3cmd setblockpublicaccess s3://BUCKET BlockPublicAcls,IgnorePublicAcls,BlockPublicPolicy,RestrictPublicBuckets โ€” Modify Block Public Access rules. Privacy please. ๐Ÿ”’
  • s3cmd setobjectlegalhold STATUS s3://BUCKET/OBJECT โ€” Modify Object Legal Hold. Legal hold, periodt. โš–๏ธ
  • s3cmd setobjectretention MODE RETAIN_UNTIL_DATE s3://BUCKET/OBJECT โ€” Modify Object Retention. Keep it for later. โณ
  • s3cmd setpolicy FILE s3://BUCKET โ€” Modify Bucket Policy. Rules are rules. ๐Ÿ“œ
  • s3cmd delpolicy s3://BUCKET โ€” Delete Bucket Policy. No more rules. ๐Ÿ—‘๏ธ
  • s3cmd setcors FILE s3://BUCKET โ€” Modify Bucket CORS. Cross-origin realness. ๐ŸŒ
  • s3cmd delcors s3://BUCKET โ€” Delete Bucket CORS. Bye CORS. ๐Ÿ‘‹
  • s3cmd payer s3://BUCKET โ€” Modify Bucket Requester Pays policy. Who pays? ๐Ÿ’ธ
  • s3cmd multipart s3://BUCKET [Id] โ€” Show multipart uploads. Big files, many parts. ๐Ÿงฉ
  • s3cmd abortmp s3://BUCKET/OBJECT Id โ€” Abort a multipart upload. Cancel that. โŒ
  • s3cmd listmp s3://BUCKET/OBJECT Id โ€” List parts of a multipart upload. See the pieces. ๐Ÿ”
  • s3cmd accesslog s3://BUCKET โ€” Enable/disable bucket access logging. Log it. ๐Ÿ“
  • s3cmd sign STRING-TO-SIGN โ€” Sign arbitrary string using the secret key. Crypto vibes. ๐Ÿ”
  • s3cmd signurl s3://BUCKET/OBJECT <expiry_epoch|+expiry_offset> โ€” Sign an S3 URL to provide limited public access with expiry. Temporary access, slay. โฐ
  • s3cmd fixbucket s3://BUCKET[/PREFIX] โ€” Fix invalid file names in a bucket. Clean up that mess. ๐Ÿงน
  • s3cmd settagging s3://BUCKET[/OBJECT] "KEY=VALUE[&KEY=VALUE ...]" โ€” Modify tagging for Bucket or Files. Tag it. ๐Ÿท๏ธ
  • s3cmd gettagging s3://BUCKET[/OBJECT] โ€” Get tagging for Bucket or Files. What tags? ๐Ÿ”–
  • s3cmd deltagging s3://BUCKET[/OBJECT] โ€” Delete tagging for Bucket or Files. Remove tags. ๐Ÿ—‘๏ธ
  • s3cmd expire s3://BUCKET โ€” Set or delete expiration rule for the bucket. Expire it. โณ
  • s3cmd setlifecycle FILE s3://BUCKET โ€” Upload a lifecycle policy for the bucket. Lifecycle, periodt. ๐Ÿ”„
  • s3cmd getlifecycle s3://BUCKET โ€” Get a lifecycle policy for the bucket. Show me the policy. ๐Ÿ“„
  • s3cmd dellifecycle s3://BUCKET โ€” Remove a lifecycle policy for the bucket. Delete that policy. ๐Ÿ—‘๏ธ
  • s3cmd setnotification FILE s3://BUCKET โ€” Upload a notification policy for the bucket. Notify me. ๐Ÿ””
  • s3cmd getnotification s3://BUCKET โ€” Get a notification policy for the bucket. What notifications? ๐Ÿ“ฌ
  • s3cmd delnotification s3://BUCKET โ€” Remove a notification policy for the bucket. No more notifications. ๐Ÿ”•

Commands for static WebSites configuration

  • s3cmd ws-create s3://BUCKET โ€” Create Website from bucket. Website era. ๐ŸŒ
  • s3cmd ws-delete s3://BUCKET โ€” Delete Website. Gone. ๐Ÿ‘‹
  • s3cmd ws-info s3://BUCKET โ€” Info about Website. The tea on your site. โ˜•

Commands for CloudFront management

  • s3cmd cflist โ€” List CloudFront distribution points. List 'em. ๐Ÿ“‹
  • s3cmd cfinfo [cf://DIST_ID] โ€” Display CloudFront distribution point parameters. Info dump. โ„น๏ธ
  • s3cmd cfcreate s3://BUCKET โ€” Create CloudFront distribution point. New distribution. โœจ
  • s3cmd cfdelete cf://DIST_ID โ€” Delete CloudFront distribution point. Delete it. ๐Ÿ—‘๏ธ
  • s3cmd cfmodify cf://DIST_ID โ€” Change CloudFront distribution point parameters. Modify it. ๐Ÿ”ง
  • s3cmd cfinval s3://BUCKET/OBJECT [s3://BUCKET/OBJECT ...] โ€” Invalidate CloudFront objects. Invalidate that cache. ๐Ÿšซ
  • s3cmd cfinvalinfo cf://DIST_ID[/INVAL_ID] โ€” Display CloudFront invalidation request(s) status. Status check. ๐Ÿ“Š

๐ŸŒˆ OPTIONS ๐ŸŒˆ

okay so some of the below specified options can have their default values set in the s3cmd config file (by default $HOME/.s3cmd). As it's a simple text file, feel free to open it with your favorite text editor and do any changes you like. No cap. ๐Ÿ’…

  • -h, --help โ€” show this help message and exit. iconic. โœจ
  • --configure โ€” Invoke interactive (re)configuration tool. Optionally use as '--configure s3://some-bucket' to test access to a specific bucket instead of attempting to list them all. Configure that vibe. ๐Ÿ”ง
  • -c FILE, --config=FILE โ€” Config file name. Defaults to $HOME/.s3cfg. Where's your config at? ๐Ÿ“
  • --dump-config โ€” Dump current configuration after parsing config files and command line options and exit. Dump it. ๐Ÿ—‘๏ธ
  • --access_key=ACCESS_KEY โ€” AWS Access Key. Your key. ๐Ÿ”‘
  • --secret_key=SECRET_KEY โ€” AWS Secret Key. Shh, secret. ๐Ÿคซ
  • --access_token=ACCESS_TOKEN โ€” AWS Access Token. Token time. ๐ŸŽŸ๏ธ
  • -n, --dry-run โ€” Only show what should be uploaded or downloaded but don't actually do it. May still perform S3 requests to get bucket listings and other information though (only for file transfer commands). Just a preview, bestie. ๐Ÿ‘€
  • -s, --ssl โ€” Use HTTPS connection when communicating with S3. (default). Secure that connection. ๐Ÿ”’
  • --no-ssl โ€” Don't use HTTPS. Living dangerously, huh? ๐Ÿ™ˆ
  • -e, --encrypt โ€” Encrypt files before uploading to S3. Encrypt it. ๐Ÿ”
  • --no-encrypt โ€” Don't encrypt files. No encryption. ๐Ÿ”“
  • -f, --force โ€” Force overwrite and other dangerous operations. Dangerous, but okay. ๐Ÿ’€
  • --continue โ€” Continue getting a partially downloaded file (only for [get] command). Pick up where you left off. โฉ
  • --continue-put โ€” Continue uploading partially uploaded files or multipart upload parts. Restarts parts/files that don't have matching size and md5. Skips files/parts that do. Note: md5sum checks are not always sufficient to check (part) file equality. Enable this at your own risk. Risky, bestie. โš ๏ธ
  • --upload-id=UPLOAD_ID โ€” UploadId for Multipart Upload, in case you want continue an existing upload (equivalent to --continue- put) and there are multiple partial uploads. Use s3cmd multipart [URI] to see what UploadIds are associated with the given URI. ID check. ๐Ÿ†”
  • --skip-existing โ€” Skip over files that exist at the destination (only for [get] and [sync] commands). Skip it. โญ๏ธ
  • -r, --recursive โ€” Recursive upload, download or removal. Go deep. ๐ŸŒ€
  • --check-md5 โ€” Check MD5 sums when comparing files for [sync]. (default). MD5 check. โœ…
  • --no-check-md5 โ€” Do not check MD5 sums when comparing files for [sync]. Only size will be compared. May significantly speed up transfer but may also miss some changed files. Faster but riskier. โšก
  • -P, --acl-public โ€” Store objects with ACL allowing read for anyone. Public access. ๐ŸŒ
  • --acl-private โ€” Store objects with default ACL allowing access for you only. Private, just for you. ๐Ÿ”’
  • --acl-grant=PERMISSION:EMAIL or USER_CANONICAL_ID โ€” Grant stated permission to a given amazon user. Permission is one of: read, write, read_acp, write_acp, full_control, all. Grant it. ๐ŸŽ
  • --acl-revoke=PERMISSION:USER_CANONICAL_ID โ€” Revoke stated permission for a given amazon user. Permission is one of: read, write, read_acp, write_acp, full_control, all. Revoke it. ๐Ÿšซ
  • -D NUM, --restore-days=NUM โ€” Number of days to keep restored file available (only for 'restore' command). Default is 1 day. How many days? ๐Ÿ“…
  • --restore-priority=RESTORE_PRIORITY โ€” Priority for restoring files from S3 Glacier (only for expedited โšก
  • --delete-removed โ€” Delete destination objects with no corresponding source file [sync]. Clean up. ๐Ÿงน
  • --no-delete-removed โ€” Don't delete destination objects [sync]. Keep 'em. ๐Ÿ›‘
  • --delete-after โ€” Perform deletes AFTER new uploads when delete-removed is enabled [sync]. Delete after. โณ
  • --delay-updates โ€” OBSOLETE Put all updated files into place at end [sync]. Obsolete, bestie. ๐Ÿ’€
  • --max-delete=NUM โ€” Do not delete more than NUM files. [del] and [sync]. Limit deletes. ๐Ÿ”ข
  • --limit=NUM โ€” Limit number of objects returned in the response body (only for [ls] and [la] commands). Limit it. ๐Ÿ“
  • --add-destination=ADDITIONAL_DESTINATIONS โ€” Additional destination for parallel uploads, in addition to last arg. May be repeated. More destinations. โž•
  • --delete-after-fetch โ€” Delete remote objects after fetching to local file (only for [get] and [sync] commands). Delete after fetch. ๐Ÿ—‘๏ธ
  • -p, --preserve โ€” Preserve filesystem attributes (mode, ownership, timestamps). Default for [sync] command. Preserve it. ๐Ÿ›๏ธ
  • --no-preserve โ€” Don't store FS attributes. Don't preserve. ๐Ÿšซ
  • --keep-dirs โ€” Preserve all local directories as remote objects including empty directories. Experimental feature. Experimental, bestie. ๐Ÿงช
  • --exclude=GLOB โ€” Filenames and paths matching GLOB will be excluded from sync. Exclude it. ๐Ÿšซ
  • --exclude-from=FILE โ€” Read --exclude GLOBs from FILE. Read from file. ๐Ÿ“„
  • --rexclude=REGEXP โ€” Filenames and paths matching REGEXP (regular expression) will be excluded from sync. Regex exclude. ๐Ÿ”
  • --rexclude-from=FILE โ€” Read --rexclude REGEXPs from FILE. Read regex from file. ๐Ÿ“„
  • --include=GLOB โ€” Filenames and paths matching GLOB will be included even if previously excluded by one of --(r)exclude(-from) patterns. Include it. โœ…
  • --include-from=FILE โ€” Read --include GLOBs from FILE. Read include from file. ๐Ÿ“„
  • --rinclude=REGEXP โ€” Same as --include but uses REGEXP (regular expression) instead of GLOB. Regex include. ๐Ÿ”
  • --rinclude-from=FILE โ€” Read --rinclude REGEXPs from FILE. Read regex include from file. ๐Ÿ“„
  • --files-from=FILE โ€” Read list of source-file names from FILE. Use - to read from stdin. Read files from file. ๐Ÿ“„
  • --region=REGION, --bucket-location=REGION โ€” Region to create bucket in, bestie ๐ŸŒ. As of now the regions are: us-east-1, us-west-1, us-west-2, eu-west-1, eu-central-1, ap-northeast-1, ap-southeast-1, ap-southeast-2, sa-east-1.
  • --host=HOSTNAME โ€” HOSTNAME:PORT for S3 endpoint. Default is s3.amazonaws.com, and alternatives are like s3-eu-west-1.amazonaws.com. You should also set --host-bucket. iykyk โœจ
  • --host-bucket=HOST_BUCKET โ€” DNS-style bucket+hostname:port template for accessing a bucket. Default is %(bucket)s.s3.amazonaws.com. template magic ๐Ÿช„
  • --reduced-redundancy, --rr โ€” Store object with 'Reduced redundancy'. Lower per-GB price. Works for [put, cp, mv]. budget-friendly vibes ๐Ÿ’ธ
  • --no-reduced-redundancy, --no-rr โ€” Store object without 'Reduced redundancy'. Higher per-GB price. Works for [put, cp, mv]. pay more, worry less ๐Ÿ’…
  • --storage-class=CLASS โ€” Store object with specified CLASS (STANDARD, STANDARD_IA, ONEZONE_IA, INTELLIGENT_TIERING, GLACIER or DEEP_ARCHIVE). Works for [put, cp, mv]. tier list, but for storage ๐Ÿ‘‘
  • --access-logging-target-prefix=LOG_TARGET_PREFIX โ€” Target prefix for access logs (S3 URI) (for [cfmodify] and [accesslog] commands). log girlies rise ๐Ÿ“
  • --no-access-logging โ€” Disable access logging (for [cfmodify] and [accesslog] commands). no logs, no crumbs ๐Ÿšซ
  • --default-mime-type=DEFAULT_MIME_TYPE โ€” Default MIME-type for stored objects. Application default is binary/octet-stream. the fallback baddie ๐ŸŽ€
  • -M, --guess-mime-type โ€” Guess MIME-type of files by their extension or mime magic. Fall back to default MIME-Type as specified by --default-mime-type option. detective mode ๐Ÿ”
  • --no-guess-mime-type โ€” Don't guess MIME-type and use the default type instead. no guessing games ๐Ÿ™…โ€โ™€๏ธ
  • --no-mime-magic โ€” Don't use mime magic when guessing MIME-type. no sparkle, just facts โœจ
  • -m MIME/TYPE, --mime-type=MIME/TYPE โ€” Force MIME-type. Override both --default-mime-type and --guess-mime-type. main character energy ๐Ÿ‘‘
  • --add-header=NAME:VALUE โ€” Add a given HTTP header to the upload request. Can be used multiple times. For instance set 'Expires' or 'Cache-Control' headers (or both) using this option. header stacking ๐Ÿงฑ
  • --remove-header=NAME โ€” Remove a given HTTP header. Can be used multiple times. For instance, remove 'Expires' or 'Cache-Control' headers (or both) using this option. Works for [modify]. bye bye header ๐Ÿ‘‹
  • --server-side-encryption โ€” Specifies that server-side encryption will be used when putting objects. Works for [put, sync, cp, modify]. security slay ๐Ÿ”
  • --server-side-encryption-kms-id=KMS_KEY โ€” Specifies the key id used for server-side encryption with AWS KMS-Managed Keys (SSE-KMS) when putting objects. Works for [put, sync, cp, modify]. KMS bestie ๐Ÿ—๏ธ
  • --encoding=ENCODING โ€” Override autodetected terminal and filesystem encoding (character set). Autodetected: UTF-8. charset chaos, but controlled ๐ŸŒˆ
  • --add-encoding-exts=EXTENSIONs โ€” Add encoding to these comma delimited extensions i.e. (css,js,html) when uploading to S3 ). extension era ๐Ÿ“
  • --verbatim โ€” Use the S3 name as given on the command line. No pre-processing, encoding, etc. Use with caution! โš ๏ธ
  • --disable-multipart โ€” Disable multipart upload on files bigger than --multipart-chunk-size-mb. one big upload energy ๐Ÿ“ฆ
  • --multipart-chunk-size-mb=SIZE โ€” Size of each chunk of a multipart upload. Files bigger than SIZE are automatically uploaded as multithreaded-multipart, smaller files are uploaded using the traditional method. SIZE is in Mega-Bytes, default chunk size is 15MB, minimum allowed chunk size is 5MB, maximum is 5GB. chunk it up ๐Ÿงฉ
  • --list-md5 โ€” Include MD5 sums in bucket listings (only for ls command). checksum cutie ๐Ÿงฎ
  • --list-allow-unordered โ€” Not an AWS standard. Allow the listing results to be returned in unsorted order. This may be faster when listing very large buckets. chaotic but fast ๐ŸŒ€
  • -H, --human-readable-sizes โ€” Print sizes in human readable form (eg 1kB instead of 1234). numbers but make it cute ๐Ÿ“
  • --ws-index=WEBSITE_INDEX โ€” Name of index-document (only for [ws-create] command). website index realness ๐ŸŒ
  • --ws-error=WEBSITE_ERROR โ€” Name of error-document (only for [ws-create] command). error doc, but make it fashion ๐Ÿšจ
  • --expiry-date=EXPIRY_DATE โ€” Indicates when the expiration rule takes effect. (only for [expire] command). expiration date, but for objects โฐ
  • --expiry-days=EXPIRY_DAYS โ€” Indicates the number of days after object creation the expiration rule takes effect. (only for [expire] command). countdown vibes ๐Ÿ—“๏ธ
  • --expiry-prefix=EXPIRY_PREFIX โ€” Identifying one or more objects with the prefix to which the expiration rule applies. (only for [expire] command). prefix picker ๐ŸŽฏ
  • --skip-destination-validation โ€” Skips validation of Amazon SQS, Amazon SNS, and AWS Lambda destinations when applying notification configuration. (only for [setnotification] command). skip the check, live dangerously ๐Ÿ’€
  • --progress โ€” Display progress meter (default on TTY). progress bar slay ๐Ÿ“Š
  • --no-progress โ€” Don't display progress meter (default on non-TTY). no bar, no noise ๐Ÿคซ
  • --stats โ€” Give some file-transfer stats. numbers girlies ๐Ÿ“ˆ
  • --enable โ€” Enable given CloudFront distribution (only for [cfmodify] command). turn it on โœ…
  • --disable โ€” Disable given CloudFront distribution (only for [cfmodify] command). turn it off โŒ
  • --cf-invalidate โ€” Invalidate the uploaded file in CloudFront. Also see [cfinval] command. cache be gone ๐Ÿ’จ
  • --cf-invalidate-default-index โ€” When using Custom Origin and S3 static website, invalidate the default index file. index file, but fresh ๐Ÿงผ
  • --cf-no-invalidate-default-index-root โ€” When using Custom Origin and S3 static website, don't invalidate the path to the default index file. leave that root alone ๐Ÿ™…โ€โ™€๏ธ
  • --cf-add-cname=CNAME โ€” Add given CNAME to a CloudFront distribution (only for [cfcreate] and [cfmodify] commands). CNAME added โž•
  • --cf-remove-cname=CNAME โ€” Remove given CNAME from a CloudFront distribution (only for [cfmodify] command). CNAME removed โž–
  • --cf-comment=COMMENT โ€” Set COMMENT for a given CloudFront distribution (only for [cfcreate] and [cfmodify] commands). comment your code, bestie ๐Ÿ’ฌ
  • --cf-default-root-object=DEFAULT_ROOT_OBJECT โ€” Set the default root object to return when no object is specified in the URL. Use a relative path, i.e. default/index.html instead of /default/index.html or s3://bucket/default/index.html (only for [cfcreate] and [cfmodify] commands). root object royalty ๐Ÿ‘‘
  • -v, --verbose โ€” Enable verbose output. tell me everything ๐Ÿ—ฃ๏ธ
  • -d, --debug โ€” Enable debug output. debug girlie ๐Ÿ›
  • --version โ€” Show s3cmd version (2.4.0) and exit. version check, then bye ๐Ÿ‘‹
  • -F, --follow-symlinks โ€” Follow symbolic links as if they are regular files. symlink? more like yes-link ๐Ÿ”—
  • --cache-file=FILE โ€” Cache FILE containing local source MD5 values. cache it, bestie ๐Ÿ’พ
  • -q, --quiet โ€” Silence output on stdout. shhh ๐Ÿค
  • --ca-certs=CA_CERTS_FILE โ€” Path to SSL CA certificate FILE (instead of system default). cert path, but custom ๐Ÿ“œ
  • --ssl-cert=SSL_CLIENT_CERT_FILE โ€” Path to client own SSL certificate CRT_FILE. your cert, your rules ๐Ÿชช
  • --ssl-key=SSL_CLIENT_KEY_FILE โ€” Path to client own SSL certificate private key KEY_FILE. private key, private vibes ๐Ÿ”‘
  • --check-certificate โ€” Check SSL certificate validity. validity check โœ…
  • --no-check-certificate โ€” Do not check SSL certificate validity. no check, no stress ๐Ÿ™ˆ
  • --check-hostname โ€” Check SSL certificate hostname validity. hostname check ๐Ÿ 
  • --no-check-hostname โ€” Do not check SSL certificate hostname validity. hostname? don't care ๐Ÿคทโ€โ™€๏ธ
  • --signature-v2 โ€” Use AWS Signature version 2 instead of newer signature methods. Helpful for S3-like systems that don't have AWS Signature v4 yet. old school signature โœ๏ธ
  • --limit-rate=LIMITRATE โ€” Limit the upload or download speed to amount bytes per second. Amount may be expressed in bytes, kilobytes with the k suffix, or megabytes with the m suffix. slow down, speed racer ๐Ÿข
  • --no-connection-pooling โ€” Disable connection reuse. no pooling, no sharing ๐Ÿšซ
  • --requester-pays โ€” Set the REQUESTER PAYS flag for operations. they pay, you play ๐Ÿ’ธ
  • -l, --long-listing โ€” Produce long listing [ls]. long listing, long lashes ๐Ÿ’…
  • --stop-on-error โ€” stop if error in transfer. stop right there ๐Ÿ›‘
  • --max-retries=NUM โ€” Maximum number of times to retry a failed request before giving up. Default is 5. five chances, then bye ๐Ÿ”
  • --content-disposition=CONTENT_DISPOSITION โ€” Provide a Content-Disposition for signed URLs, e.g., "inline; filename=myvideo.mp4". signed URL, cute filename ๐ŸŽฌ
  • --content-type=CONTENT_TYPE โ€” Provide a Content-Type for signed URLs, e.g., "video/mp4". content type, but make it video ๐ŸŽฅ

๐Ÿ’– EXAMPLES ๐Ÿ’–

Okay bestie, this is the part where we get into it. One of the most powerful commands of s3cmd is s3cmd sync, used for synchronising complete directory trees to or from remote S3 storage. And lowkey? s3cmd put and s3cmd get share a similar behaviour with sync, to some extent. So you're basically learning the main character command. ๐Ÿ‘‘


โœจ The basics (backup vibes) โœจ

Basic usage common in backup scenarios is as simple as:

s3cmd sync /local/path/ s3://test-bucket/backup/

This command will find all files under /local/path directory and copy them to corresponding paths under s3://test-bucket/backup on the remote side. For example:

/local/path/file1.ext         ->  s3://bucket/backup/file1.ext
/local/path/dir123/file2.bin  ->  s3://bucket/backup/dir123/file2.bin

๐ŸŽ€ The trailing slash thing (iykyk) ๐ŸŽ€

However โ€” and this is the plot twist โ€” if the local path doesn't end with a slash, the last directory's name is used on the remote side as well. Compare these with the previous example:

s3cmd sync /local/path s3://test-bucket/backup/

will sync:

/local/path/file1.ext         ->  s3://bucket/backup/path/file1.ext
/local/path/dir123/file2.bin  ->  s3://bucket/backup/path/dir123/file2.bin

See how path showed up in there? Yeah. That's the slash doing its thing. Slash = no extra directory. No slash = directory name tags along. ๐Ÿ’…


๐Ÿฆ‹ Getting your files BACK ๐Ÿฆ‹

To retrieve the files back from S3 use inverted syntax:

s3cmd sync s3://test-bucket/backup/ ~/restore/

that will download files:

s3://bucket/backup/file1.ext         ->  ~/restore/file1.ext
s3://bucket/backup/dir123/file2.bin  ->  ~/restore/dir123/file2.bin

Without the trailing slash on source the behaviour is similar to what has been demonstrated with upload:

s3cmd sync s3://test-bucket/backup ~/restore/

will download the files as:

s3://bucket/backup/file1.ext         ->  ~/restore/backup/file1.ext
s3://bucket/backup/dir123/file2.bin  ->  ~/restore/backup/dir123/file2.bin

It's giving โœจsymmetricโœจ. Both directions play by the same rules. ๐ŸŒˆ


๐ŸŒธ Exclude / include matching (the rules) ๐ŸŒธ

All source file names โ€” the bold ones above โ€” are matched against exclude rules, and those that match are then re-checked against include rules to see whether they should be excluded or kept in the source list.

For the purpose of --exclude and --include matching only the bold file names above are used. For instance only path/file1.ext is tested against the patterns, not /local/path/file1.ext.

Both --exclude and --include work with shell-style wildcards (a.k.a. GLOB). For a greater flexibility s3cmd provides Regular-expression versions of the two exclude options named --rexclude and --rinclude. The options with ...-from suffix (eg --rinclude-from) expect a filename as an argument. Each line of such a file is treated as one pattern.

There is only one set of patterns built from all --(r)exclude(-from) options, and similarly for the include variant. Any file excluded with eg --exclude can be put back with a pattern found in --rinclude-from list. ๐Ÿ’œ

Run s3cmd with --dry-run to verify that your rules work as expected. Use together with --debug to get detailed information about matching file names against exclude and include rules. Do this, bestie. Trust. ๐Ÿ™ˆ

๐Ÿ“ The examples you'll actually screenshot ๐Ÿ“

For example to exclude all files with ".jpg" extension except those beginning with a number use:

--exclude '*.jpg' --rinclude '[0-9].*.jpg'

To exclude all files except "*.jpg" extension, use:

--exclude '*' --include '*.jpg'

To exclude local directory 'somedir', be sure to use a trailing forward slash, as such:

--exclude 'somedir/'

That trailing slash? Not optional. Do not forget it. ๐Ÿซถ


๐Ÿ”ฅ SEE ALSO ๐Ÿ”ฅ

  • For the most up to date list of options run: s3cmd --help
  • For more info about usage, examples and other related info visit project homepage at: https://s3tools.org

๐Ÿ‘‘ AUTHOR ๐Ÿ‘‘

Written by Michal Ludvig, Florent Viard and contributors. Legends, honestly. โœจ


๐Ÿ’Œ CONTACT, SUPPORT ๐Ÿ’Œ

Preferred way to get support is our mailing list:

s3tools-general@lists.sourceforge.net

or visit the project homepage:

https://s3tools.org


๐Ÿ’€ REPORTING BUGS ๐Ÿ’€

Report bugs to s3tools-bugs@lists.sourceforge.net


Copyright ยฉ 2007-2023 TGRMN Software (https://www.tgrmn.com), Sodria SAS (https://www.sodria.com) and contributors


๐Ÿ“œ LICENSE ๐Ÿ“œ

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.


And that's the whole page, bestie โ€” s3cmd(1) and its manual, start to finish. Go sync something iconic. ๐Ÿ’–โœจ๐ŸŽ€๐Ÿฆ‹๐ŸŒธ