Using mc

Using mc with the object storage #

Configure mc #

Head over to minio’s website and download mc (Minio Client) for your operating system:

mc is a standalone tool and is available free of charge, and licensed using the AGPL. Configure mc to use our object storage:

$ mc alias set pn-storage \
  your-key-id \

The above creates an alias called pn-storage which you can use as a shorthand with mc when you copy files from or to your buckets. Beware: it also saves the credentials along with it into ~/.mc where you can inspect settings.

Using mc #

mc is a nice command-line tool to help with day to day operations with the object storage.

Create a bucket #

A bucket is a namespace on the object storage, bucket names are globally unique and can be anything as long as it is DNS-compatible. We suggest to name your buckets after domains you own, for example:

Create a bucket with mc:

$ mc mb pn-storage/{{ s3.bucket }}
Bucket created successfully `pn-storage/`.

Upload a file to a bucket #

In the following example we create a text file with the contents Hallo Welt and upload it to our bucket:

$ echo "Hallo Welt" > hello-world.txt
$ mc cp hello-world.txt pn-storage/
hello-world.txt:                                 11 B / 11 B  ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓  441 B/s 0s

List the contents of a bucket #

$ mc ls pn-storage/
[2022-02-24 11:31:38 CET]    11B hello-world.txt.

Or, get a tree view - a pseudo directory listing:

❯ mc tree pn-storage

Mirror (or copy) files #

To clone/upload an entire directory to the storage:

❯ mc mirror ./local-directory pn-storage/
...something/something:  6.54 MiB / 6.54 MiB  ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓  1.03 MiB/s 6s

Make files public #

When using mc mirror, mc cp or mc sync, you can supply an --attr option to set a file policy to change the accessibility from its default (which is private).

As an example, in order to re-upload a local directory to the object storage and to force a public-read policy on files contained, use the following as an example:

./mc mirror \
--attr x-amz-acl=public-read \
--overwrite \
./directory \

… among many other things.