Skip to content
This repository


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

file 224 lines (216 sloc) 7.484 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224
.TH s3cmd 1
s3cmd \- tool for managing Amazon S3 storage space
.B s3cmd
.B 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.
.B s3cmd
can do several \fIactions\fR specified by the following \fIcommands\fR.
\fBmb\fR \fIs3://BUCKET\fR
Make bucket
\fBrb\fR \fIs3://BUCKET\fR
Remove bucket
\fBls\fR \fI[s3://BUCKET[/PREFIX]]\fR
List objects or buckets
List all object in all buckets
\fBput\fR \fIFILE [FILE...] s3://BUCKET[/PREFIX]\fR
Put file into bucket (i.e. upload to S3)
Get file from bucket (i.e. download from S3)
\fBdel\fR \fIs3://BUCKET/OBJECT\fR
Delete file from bucket
Backup a directory tree to S3
Restore a tree from S3 to local directory
\fBinfo\fR \fIs3://BUCKET[/OBJECT]\fR
Get various information about a Bucket or Object
\fBdu\fR \fI[s3://BUCKET[/PREFIX]]\fR
Disk usage \- amount of data stored in S3

Some of the below specified options can have their default
values set in
.B 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.
Config file related options.
Invoke interactive (re)configuration tool. Don't worry, you won't
lose your settings on subsequent runs.
\fB\-c\fR FILE, \fB\-\-config\fR=FILE
Config file name. Defaults to $HOME/.s3cfg
Dump current configuration after parsing config files
and command line options and exit.
Most options can have a default value set in the above specified config file.
Options specific to \fBsync\fR command:
Delete remote objects with no corresponding local file when \fIsync\fRing \fBto\fR S3 or delete local files with no corresponding object in S3 when \fIsync\fRing \fBfrom\fR S3.
Don't delete remote objects. Default for 'sync' command.
\fB\-p\fR, \fB\-\-preserve\fR
Preserve filesystem attributes (mode, ownership, timestamps). Default for 'sync' command.
Don't store filesystem attributes with uploaded files.
\fB\-\-exclude GLOB\fR
Exclude files matching GLOB (a.k.a. shell-style wildcard) from \fIsync\fI. See SYNC COMMAND section for more information.
\fB\-\-exclude\-from FILE\fR
Same as \-\-exclude but reads GLOBs from the given FILE instead of expecting them on the command line.
\fB\-\-rexclude REGEXP\fR
Same as \-\-exclude but works with REGEXPs (Regular expressions).
\fB\-\-rexclude\-from FILE\fR
Same as \-\-exclude\-from but works with REGEXPs.
\fB\-\-debug\-syncmatch\fR or \fB\-\-debug\-exclude\fR (alias)
Display detailed information about matching file names against exclude\-rules as well as information about remote vs local filelists matching. S3cmd exits after performing the match and no actual transfer takes place.
.\"\fB\-n\fR, \fB\-\-dry\-run\fR
.\"Only show what would be uploaded or downloaded but don't actually do it. May still perform S3 requests to get bucket listings and other information though.
Options common for all commands (where it makes sense indeed):
\fB\-f\fR, \fB\-\-force\fR
Force overwrite and other dangerous operations.
\fB\-P\fR, \fB\-\-acl\-public\fR
Store objects with permissions allowing read for anyone.
Store objects with default ACL allowing access for you only.
Specify datacentre where to create the bucket. Possible values are \fIUS\fR (default) or \fIEU\fR.
\fB\-e\fR, \fB\-\-encrypt\fR
Use GPG encryption to protect stored objects from unauthorized access.
\fB\-m\fR MIME/TYPE, \fB\-\-mime\-type\fR=MIME/TYPE
Default MIME\-type to be set for objects stored.
\fB\-M\fR, \fB\-\-guess\-mime\-type\fR
Guess MIME\(hytype of files by their extension. Falls
back to default MIME\(hyType as specified by \fB\-\-mime\-type\fR
\fB\-H\fR, \fB\-\-human\-readable\-sizes\fR
Print sizes in human readable form.
.\"\fB\-u\fR, \fB\-\-show\-uri\fR
.\"Show complete S3 URI in listings.
\fB\-v\fR, \fB\-\-verbose\fR
Enable verbose output.
\fB\-d\fR, \fB\-\-debug\fR
Enable debug output.
\fB\-h\fR, \fB\-\-help\fR
Show the help message and exit
.B s3cmd
version and exit.

One of the most powerful commands of \fIs3cmd\fR is \fBs3cmd sync\fR used for
synchronising complete directory trees to or from remote S3 storage.
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\fB/file1.ext\fR \-> s3://test-bucket/backup\fB/file1.ext\fR
/local/path\fB/dir123/file2.bin\fR \-> s3://test-bucket/backup\fB/dir123/file2.bin\fR

To retrieve the files back from S3 use inverted syntax:
s3cmd sync s3://test-bucket/backup/ /tmp/restore
that will download files:
s3://test-bucket/backup\fB/file1.ext\fR \-> /tmp/restore\fB/file1.ext\fR
s3://test-bucket/backup\fB/dir123/file2.bin\fR \-> /tmp/restore\fB/dir123/file2.bin\fR

For the purpose of \fB\-\-exclude\fR and \fB\-\-exclude\-from\fR matching the file name
\fIalways\fR begins with \fB/\fR (slash) and has the local or remote common part removed.
For instance in the previous example the file names tested against \-\-exclude list
will be \fB/\fRfile1.ext and \fB/\fRdir123/file2.bin, that is both with the leading
slash regardless whether you specified s3://test-bucket/backup or
s3://test-bucket/backup/ (note the trailing slash) on the command line.

Both \fB\-\-exclude\fR and \fB\-\-exclude\-from\fR work with shell-style wildcards (a.k.a. GLOB).
For a greater flexibility s3cmd provides Regular-expression versions of the two exclude options
named \fB\-\-rexclude\fR and \fB\-\-rexclude\-from\fR.

Run s3cmd with \fB\-\-debug\-syncmatch\fR to get detailed information
about matching file names against exclude rules.

For example to exclude all files with ".bin" extension with a REGEXP use:
\-\-rexclude '\.bin$'
to exclude all hidden files and subdirectories (i.e. those whose name begins with dot ".") use GLOB:
\-\-exclude '/.*'
on the other hand to exclude only hidden files but not hidden subdirectories use REGEXP:
\-\-rexclude '/\.[^/]*$'

Written by Michal Ludvig <>
Report bugs to
.I s3tools\
Copyright \(co 2007,2008 Michal Ludvig <>
This is free software. You may redistribute copies of it under the terms of
the GNU General Public License version 2 <>.
There is NO WARRANTY, to the extent permitted by law.
For the most up to date list of options run
.B s3cmd \-\-help
For more info about usage, examples and other related info visit project homepage at
Something went wrong with that request. Please try again.