• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

.github/H09-Dec-2021-206157

buildscripts/H09-Dec-2021-423242

cmd/H03-May-2022-47,53932,855

docs/H09-Dec-2021-3,3552,575

pkg/H09-Dec-2021-996528

testdata/H09-Dec-2021-5149

vendor/H03-May-2022-5,237,6794,353,709

www/minio-client/files/H03-May-2022-408404

.gitignoreH A D09-Dec-2021101 1413

.golangci.ymlH A D09-Dec-2021651 3530

.goreleaser.ymlH A D09-Dec-20213.5 KiB168148

.mailmapH A D09-Dec-2021711 1613

CONFLICT.mdH A D09-Dec-2021845 117

CONTRIBUTING.mdH A D09-Dec-20211.5 KiB3730

CREDITSH A D09-Dec-2021434.7 KiB8,4056,814

DockerfileH A D09-Dec-2021655 2819

Dockerfile.devH A D09-Dec-2021315 1510

Dockerfile.releaseH A D09-Dec-2021485 2013

LICENSEH A D09-Dec-202133.7 KiB662544

MakefileH A D09-Dec-20212.4 KiB8360

NOTICEH A D09-Dec-2021354 107

README.mdH A D09-Dec-20218.4 KiB243196

README_zh_CN.mdH A D09-Dec-20215.7 KiB174134

_config.ymlH A D09-Dec-202127 11

code_of_conduct.mdH A D09-Dec-20213.5 KiB8161

contributors.shH A D09-Dec-20211.1 KiB359

docker-buildx.shH A D09-Dec-20211.8 KiB5423

functional-tests.shH A D09-Dec-202143.1 KiB1,117793

go.modH A D09-Dec-20214 KiB9995

go.sumH A D09-Dec-202174.2 KiB782781

main.goH A D09-Dec-2021892 298

staticcheck.confH A D09-Dec-202127 21

README.md

1# MinIO Client Quickstart Guide
2[![Slack](https://slack.min.io/slack?type=svg)](https://slack.min.io) [![Go Report Card](https://goreportcard.com/badge/minio/mc)](https://goreportcard.com/report/minio/mc) [![Docker Pulls](https://img.shields.io/docker/pulls/minio/mc.svg?maxAge=604800)](https://hub.docker.com/r/minio/mc/) [![license](https://img.shields.io/badge/license-AGPL%20V3-blue)](https://github.com/minio/mc/blob/master/LICENSE)
3
4MinIO Client (mc) provides a modern alternative to UNIX commands like ls, cat, cp, mirror, diff, find etc. It supports filesystems and Amazon S3 compatible cloud storage service (AWS Signature v2 and v4).
5
6```
7alias       set, remove and list aliases in configuration file
8ls          list buckets and objects
9mb          make a bucket
10rb          remove a bucket
11cp          copy objects
12mirror      synchronize object(s) to a remote site
13cat         display object contents
14head        display first 'n' lines of an object
15pipe        stream STDIN to an object
16share       generate URL for temporary access to an object
17find        search for objects
18sql         run sql queries on objects
19stat        show object metadata
20mv          move objects
21tree        list buckets and objects in a tree format
22du          summarize disk usage recursively
23retention   set retention for object(s)
24legalhold   set legal hold for object(s)
25diff        list differences in object name, size, and date between two buckets
26rm          remove objects
27encrypt    manage bucket encryption config
28event       manage object notifications
29watch       listen for object notification events
30undo        undo PUT/DELETE operations
31policy      manage anonymous access to buckets and objects
32tag         manage tags for bucket(s) and object(s)
33ilm         manage bucket lifecycle
34version     manage bucket versioning
35replicate   configure server side bucket replication
36admin       manage MinIO servers
37update      update mc to latest release
38```
39
40## Docker Container
41### Stable
42```
43docker pull minio/mc
44docker run minio/mc ls play
45```
46
47### Edge
48```
49docker pull minio/mc:edge
50docker run minio/mc:edge ls play
51```
52
53**Note:** Above examples run `mc` against MinIO [_play_ environment](#test-your-setup) by default. To run `mc` against other S3 compatible servers, start the container this way:
54
55```
56docker run -it --entrypoint=/bin/sh minio/mc
57```
58
59then use the [`mc config` command](#add-a-cloud-storage-service).
60
61### GitLab CI
62When using the Docker container in GitLab CI, you must [set the entrypoint to an empty string](https://docs.gitlab.com/ee/ci/docker/using_docker_images.html#overriding-the-entrypoint-of-an-image).
63
64```
65deploy:
66  image:
67    name: minio/mc
68    entrypoint: ['']
69  stage: deploy
70  before_script:
71    - mc alias set minio $MINIO_HOST $MINIO_ACCESS_KEY $MINIO_SECRET_KEY
72  script:
73    - mc cp <source> <destination>
74```
75
76## macOS
77### Homebrew
78Install mc packages using [Homebrew](http://brew.sh/)
79
80```
81brew install minio/stable/mc
82mc --help
83```
84
85## GNU/Linux
86### Binary Download
87| Platform | Architecture | URL |
88| ---------- | -------- |------|
89|GNU/Linux|64-bit Intel|https://dl.min.io/client/mc/release/linux-amd64/mc |
90||64-bit PPC|https://dl.min.io/client/mc/release/linux-ppc64le/mc |
91
92```
93wget https://dl.min.io/client/mc/release/linux-amd64/mc
94chmod +x mc
95./mc --help
96```
97
98## Microsoft Windows
99### Binary Download
100| Platform | Architecture | URL |
101| ---------- | -------- |------|
102|Microsoft Windows|64-bit Intel|https://dl.min.io/client/mc/release/windows-amd64/mc.exe |
103
104```
105mc.exe --help
106```
107
108## Install from Source
109Source installation is only intended for developers and advanced users. If you do not have a working Golang environment, please follow [How to install Golang](https://golang.org/doc/install). Minimum version required is [go1.17](https://golang.org/dl/#stable)
110
111```sh
112go install github.com/minio/mc@latest
113```
114
115## Add a Cloud Storage Service
116If you are planning to use `mc` only on POSIX compatible filesystems, you may skip this step and proceed to [everyday use](#everyday-use).
117
118To add one or more Amazon S3 compatible hosts, please follow the instructions below. `mc` stores all its configuration information in ``~/.mc/config.json`` file.
119
120```
121mc alias set <ALIAS> <YOUR-S3-ENDPOINT> <YOUR-ACCESS-KEY> <YOUR-SECRET-KEY> --api <API-SIGNATURE> --path <BUCKET-LOOKUP-TYPE>
122```
123
124`<ALIAS>` is simply a short name to your cloud storage service. S3 end-point, access and secret keys are supplied by your cloud storage provider. API signature is an optional argument. By default, it is set to "S3v4".
125
126Path is an optional argument. It is used to indicate whether dns or path style url requests are supported by the server. It accepts "on", "off" as valid values to enable/disable path style requests.. By default, it is set to "auto" and SDK automatically determines the type of url lookup to use.
127
128### Example - MinIO Cloud Storage
129MinIO server startup banner displays URL, access and secret keys.
130
131```
132mc alias set minio http://192.168.1.51 BKIKJAA5BMMU2RHO6IBB V7f1CwQqAcwo80UEIJEjc5gVQUSSx5ohQ9GSrr12
133```
134
135### Example - Amazon S3 Cloud Storage
136Get your AccessKeyID and SecretAccessKey by following [AWS Credentials Guide](http://docs.aws.amazon.com/general/latest/gr/aws-security-credentials.html).
137
138```
139mc alias set s3 https://s3.amazonaws.com BKIKJAA5BMMU2RHO6IBB V7f1CwQqAcwo80UEIJEjc5gVQUSSx5ohQ9GSrr12
140```
141
142**Note**: As an IAM user on Amazon S3 you need to make sure the user has full access to the buckets or set the following restricted policy for your IAM user
143
144```json
145{
146    "Version": "2012-10-17",
147    "Statement": [
148        {
149            "Sid": "AllowBucketStat",
150            "Effect": "Allow",
151            "Action": [
152                "s3:HeadBucket"
153            ],
154            "Resource": "*"
155        },
156        {
157            "Sid": "AllowThisBucketOnly",
158            "Effect": "Allow",
159            "Action": "s3:*",
160            "Resource": [
161                "arn:aws:s3:::<your-restricted-bucket>/*",
162                "arn:aws:s3:::<your-restricted-bucket>"
163            ]
164        }
165    ]
166}
167```
168
169### Example - Google Cloud Storage
170Get your AccessKeyID and SecretAccessKey by following [Google Credentials Guide](https://cloud.google.com/storage/docs/migrating?hl=en#keys)
171
172```
173mc alias set gcs  https://storage.googleapis.com BKIKJAA5BMMU2RHO6IBB V8f1CwQqAcwo80UEIJEjc5gVQUSSx5ohQ9GSrr12
174```
175
176## Test Your Setup
177`mc` is pre-configured with https://play.min.io, aliased as "play". It is a hosted MinIO server for testing and development purpose.  To test Amazon S3, simply replace "play" with "s3" or the alias you used at the time of setup.
178
179*Example:*
180
181List all buckets from https://play.min.io
182
183```
184mc ls play
185[2016-03-22 19:47:48 PDT]     0B my-bucketname/
186[2016-03-22 22:01:07 PDT]     0B mytestbucket/
187[2016-03-22 20:04:39 PDT]     0B mybucketname/
188[2016-01-28 17:23:11 PST]     0B newbucket/
189[2016-03-20 09:08:36 PDT]     0B s3git-test/
190```
191
192Make a bucket
193`mb` command creates a new bucket.
194
195*Example:*
196```
197mc mb play/mybucket
198Bucket created successfully `play/mybucket`.
199```
200
201Copy Objects
202`cp` command copies data from one or more sources to a target.
203
204*Example:*
205```
206mc cp myobject.txt play/mybucket
207myobject.txt:    14 B / 14 B  ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓  100.00 % 41 B/s 0
208```
209
210## Everyday Use
211
212### Shell aliases
213You may add shell aliases to override your common Unix tools.
214
215```
216alias ls='mc ls'
217alias cp='mc cp'
218alias cat='mc cat'
219alias mkdir='mc mb'
220alias pipe='mc pipe'
221alias find='mc find'
222```
223
224### Shell autocompletion
225In case you are using bash, zsh or fish. Shell completion is embedded by default in `mc`, to install auto-completion use `mc --autocompletion`. Restart the shell, mc will auto-complete commands as shown below.
226
227```
228mc <TAB>
229admin    config   diff     find     ls       mirror   policy   session  sql      update   watch
230cat      cp       event    head     mb       pipe     rm       share    stat     version
231```
232
233## Explore Further
234- [MinIO Client Complete Guide](https://docs.min.io/docs/minio-client-complete-guide)
235- [MinIO Quickstart Guide](https://docs.min.io/docs/minio-quickstart-guide)
236- [The MinIO documentation website](https://docs.min.io)
237
238## Contribute to MinIO Project
239Please follow MinIO [Contributor's Guide](https://github.com/minio/mc/blob/master/CONTRIBUTING.md)
240
241## License
242Use of `mc` is governed by the GNU AGPLv3 license that can be found in the [LICENSE](https://github.com/minio/mc/blob/master/LICENSE) file.
243

README_zh_CN.md

1# MinIO客户端快速入门指南
2[![Slack](https://slack.min.io/slack?type=svg)](https://slack.min.io) [![Go Report Card](https://goreportcard.com/badge/minio/mc)](https://goreportcard.com/report/minio/mc) [![Docker Pulls](https://img.shields.io/docker/pulls/minio/mc.svg?maxAge=604800)](https://hub.docker.com/r/minio/mc/)
3
4MinIO Client (mc)为ls,cat,cp,mirror,diff,find等UNIX命令提供了一种替代方案。它支持文件系统和兼容Amazon S3的云存储服务(AWS Signature v2和v4)。
5
6
7```
8ls       列出文件和文件夹。
9mb       创建一个存储桶或一个文件夹。
10cat      显示文件和对象内容。
11pipe     将一个STDIN重定向到一个对象或者文件或者STDOUT。
12share    生成用于共享的URL。
13cp       拷贝文件和对象。
14mirror   给存储桶和文件夹做镜像。
15find     基于参数查找文件。
16diff     对两个文件夹或者存储桶比较差异。
17rm       删除文件和对象。
18events   管理对象通知。
19watch    监听文件和对象的事件。
20policy   管理访问策略。
21session  为cp命令管理保存的会话。
22config   管理mc配置文件。
23update   检查软件更新。
24version  输出版本信息。
25```
26
27## Docker容器
28### 稳定版
29```
30docker pull minio/mc
31docker run minio/mc ls play
32```
33
34### 尝鲜版
35```
36docker pull minio/mc:edge
37docker run minio/mc:edge ls play
38```
39
40**注意:** 上述示例默认使用MinIO[演示环境](#test-your-setup)做演示,如果想用`mc`操作其它S3兼容的服务,采用下面的方式来启动容器:
41
42```
43docker run -it --entrypoint=/bin/sh minio/mc
44```
45
46然后使用[`mc config`命令](#add-a-cloud-storage-service)。
47
48## macOS
49### Homebrew
50使用[Homebrew](http://brew.sh/)安装mc。
51
52```
53brew install minio/stable/mc
54mc --help
55```
56
57## GNU/Linux
58### 下载二进制文件
59| 平台 | CPU架构 | URL |
60| ---------- | -------- |------|
61|GNU/Linux|64-bit Intel|https://dl.min.io/client/mc/release/linux-amd64/mc |
62
63```
64chmod +x mc
65./mc --help
66```
67
68## Microsoft Windows
69### 下载二进制文件
70| 平台 | CPU架构 | URL |
71| ---------- | -------- |------|
72|Microsoft Windows|64-bit Intel|https://dl.min.io/client/mc/release/windows-amd64/mc.exe |
73
74```
75mc.exe --help
76```
77
78## 通过源码安装
79通过源码安装仅适用于开发人员和高级用户。`mc update`命令不支持基于源码安装的更新通知。请从https://min.io/download/#minio-client下载官方版本。
80
81如果您没有Golang环境,请参照[如何安装Golang](https://golang.org/doc/install)82
83```
84go get -d github.com/minio/mc
85cd ${GOPATH}/src/github.com/minio/mc
86make
87```
88
89## 添加一个云存储服务
90如果你打算仅在POSIX兼容文件系统中使用`mc`,那你可以直接略过本节,跳到[日常使用](#everyday-use)。
91
92添加一个或多个S3兼容的服务,请参考下面说明。`mc`将所有的配置信息都存储在``~/.mc/config.json``文件中。
93
94```
95mc alias set <ALIAS> <YOUR-S3-ENDPOINT> <YOUR-ACCESS-KEY> <YOUR-SECRET-KEY> [--api API-SIGNATURE]
96```
97
98别名就是给你的云存储服务起了一个短点的外号。S3 endpoint,access key和secret key是你的云存储服务提供的。API签名是可选参数,默认情况下,它被设置为"S3v4"。
99
100### 示例-MinIO云存储
101从MinIO服务获得URL、access key和secret key。
102
103```
104mc alias set minio http://192.168.1.51 BKIKJAA5BMMU2RHO6IBB V7f1CwQqAcwo80UEIJEjc5gVQUSSx5ohQ9GSrr12 --api s3v4
105```
106
107### 示例-Amazon S3云存储
108参考[AWS Credentials指南](http://docs.aws.amazon.com/general/latest/gr/aws-security-credentials.html)获取你的AccessKeyID和SecretAccessKey。
109
110```
111mc alias set s3 https://s3.amazonaws.com BKIKJAA5BMMU2RHO6IBB V7f1CwQqAcwo80UEIJEjc5gVQUSSx5ohQ9GSrr12 --api s3v4
112```
113
114### 示例-Google云存储
115参考[Google Credentials Guide](https://cloud.google.com/storage/docs/migrating?hl=en#keys)获取你的AccessKeyID和SecretAccessKey。
116
117```
118mc alias set gcs  https://storage.googleapis.com BKIKJAA5BMMU2RHO6IBB V8f1CwQqAcwo80UEIJEjc5gVQUSSx5ohQ9GSrr12 --api s3v2
119```
120
121注意:Google云存储只支持旧版签名版本V2,所以你需要选择S3v2。
122
123## 验证
124`mc`预先配置了云存储服务URL:https://play.min.io,别名“play”。它是一个用于研发和测试的MinIO服务。如果想测试Amazon S3,你可以将“play”替换为“s3”。
125
126*示例:*
127
128列出https://play.min.io上的所有存储桶。
129
130```
131mc ls play
132[2016-03-22 19:47:48 PDT]     0B my-bucketname/
133[2016-03-22 22:01:07 PDT]     0B mytestbucket/
134[2016-03-22 20:04:39 PDT]     0B mybucketname/
135[2016-01-28 17:23:11 PST]     0B newbucket/
136[2016-03-20 09:08:36 PDT]     0B s3git-test/
137```
138<a name="everyday-use"></a>
139## 日常使用
140
141### Shell别名
142你可以添加shell别名来覆盖默认的Unix工具命令。
143
144```
145alias ls='mc ls'
146alias cp='mc cp'
147alias cat='mc cat'
148alias mkdir='mc mb'
149alias pipe='mc pipe'
150alias find='mc find'
151```
152
153### Shell自动补全
154你也可以下载[`autocomplete/bash_autocomplete`](https://raw.githubusercontent.com/minio/mc/master/autocomplete/bash_autocomplete)到`/etc/bash_completion.d/`,然后将其重命名为`mc`。别忘了在这个文件运行source命令让其在你的当前shell上可用。
155
156```
157sudo wget https://raw.githubusercontent.com/minio/mc/master/autocomplete/bash_autocomplete -O /etc/bash_completion.d/mc
158source /etc/bash_completion.d/mc
159```
160
161```
162mc <TAB>
163admin    config   diff     ls       mirror   policy   session  update   watch
164cat      cp       events   mb       pipe     rm       share    version
165```
166
167## 了解更多
168- [MinIO Client完全指南](https://docs.min.io/docs/minio-client-complete-guide)
169- [MinIO快速入门](https://docs.min.io/docs/minio-quickstart-guide)
170- [MinIO官方文档](https://docs.min.io)
171
172## 贡献
173请遵守MinIO[贡献者指南](https://github.com/minio/mc/blob/master/docs/zh_CN/CONTRIBUTING.md)
174