A few quick fixes noted in several issues: - Literal reference in mc batch generate pointed to the wrong include Closes #1318 - Lingering reference to an "unregister" function removed Closes #1324 - Adds admonition about root credentials required, even with KES Closes #1325 - Adds mc batch cancel to list of commands on batch framework overview page Closes #1310 - Updates mc client page S3 link to avoid possible copy/paste confusion Closes #1311
21 KiB
MinIO Client
minio
Table of Contents
mc
The MinIO Client mc command line tool provides a modern alternative
to UNIX commands like ls, cat,
cp, mirror, and diff with support
for both filesystems and Amazon S3-compatible cloud storage
services.
mc has the
following syntax:
mc [GLOBALFLAGS] COMMAND --help
See minio-mc-commands for a list of supported
commands.
Version Alignment with MinIO Server
The MinIO Client releases separately from the MinIO Server.
For best functionality and compatibility, use a MinIO Client version released closely to your MinIO Server version. For example, a MinIO Client released the same day or later than your MinIO Server version.
You can install a version of the MinIO Client that is more recent
than the MinIO Server version. However, if the MinIO Client version
skews too far from the MinIO Server version, you may see increased
warnings or errors as a result of the differences. For example, while
core S3 APIs around copying (mc cp) may remain unchanged, some features or flags may
only be available or stable if the client and server versions are
aligned.
Quickstart
1) Install mc
Install the mc
command line tool onto the host machine. Click the tab that corresponds
to the host machine operating system or environment:
2) Create an Alias for the S3-Compatible Service
Important
The following example temporarily disables the bash history to mitigate the risk of authentication credentials leaking in plain text. This is a basic security measure and does not mitigate all possible attack vectors. Defer to security best practices for your operating system for inputting sensitive information on the command line.
Use the mc alias set
command to add an Amazon S3-compatible service to the mc configuration <mc-configuration>.
bash +o history
mc alias set ALIAS HOSTNAME ACCESS_KEY SECRET_KEY
bash -o history
- Replace
ALIASwith a name to associate to the S3 service.mccommands typically requireALIASas an argument for identifying which S3 service to execute against. - Replace
HOSTNAMEwith the URL endpoint or IP address of the S3 service. - Replace
ACCESS_KEYandSECRET_KEYwith the access and secret keys for a user on the S3 service.
Replace each argument with the required values. If you omit the
ACCESS_KEY and SECRET_KEY, the command prompts
you to enter those values in the CLI.
Each of the following tabs contains a provider-specific example:
MinIO Server
mc alias set myminio https://minioserver.example.net ACCESS_KEY SECRET_KEY
AWS S3 Storage
mc alias set myS3 https://s3.{your-region-code}.amazonaws.com/endpoint ACCESS_KEY SECRET_KEY
Google Cloud Storage
mc alias set myGCS https://storage.googleapis.com/endpoint ACCESS_KEY SECRET_KEY
3) Test the Connection
Use the mc admin info command to test the connection to the
newly added MinIO deployment:
mc admin info myminio
The command returns information on the S3 service if successful. If unsuccessful, check each of the following:
The host machine has connectivity to the S3 service URL (i.e. using
pingortraceroute).The specified
ACCESSKEYandSECRETKEYcorrespond to a user on the S3 service. The user must have permission to perform actions on the service.For MinIO deployments, see
minio-access-managementfor more information on user access permissions. For other S3-compatible services, defer to the documentation for that service.
Command Quick Reference
The following table lists mc commands:
Note
The MinIO Client also includes an administration extension for
managing MinIO deployments. See mc admin for more complete documentation.
The below table does not include those commands.
| Command | Description |
|---|---|
mc alias listmc alias removemc alias setmc alias importmc alias export |
|
mc anonymous getmc anonymous get-jsonmc anonymous linksmc anonymous listmc anonymous setmc anonymous set-json |
|
mc batch describemc batch generatemc batch listmc batch startmc batch status |
|
mc cat |
|
mc cp |
|
mc diff |
|
mc du |
|
mc encrypt clearmc encrypt infomc encrypt set |
|
mc event addmc event lsmc event rm |
|
mc find |
|
mc get |
|
mc head |
|
mc idp ldap accesskeymc idp ldap accesskey create-with-loginmc idp ldap addmc idp ldap disablemc idp ldap enablemc idp ldap infomc idp ldap lsmc idp ldap policymc idp ldap rmmc idp ldap update |
|
mc idp openid addmc idp openid disablemc idp openid enablemc idp openid infomc idp openid lsmc idp openid rmmc idp openid update |
|
mc idp ldap policy attachmc idp ldap policy detachmc idp ldap policy entities |
|
mc ilm restoremc ilm rule addmc ilm rule editmc ilm rule exportmc ilm rule importmc ilm rule lsmc ilm rule rmmc ilm tier addmc ilm tier checkmc ilm tier infomc ilm tier lsmc ilm tier rmmc ilm tier update |
|
mc legalhold clearmc legalhold infomc legalhold set |
|
mc license infomc license registermc license update |
|
mc ls |
|
mc mb |
|
mc mirror |
|
mc mv |
|
mc od |
|
mc ping |
|
mc pipe |
|
mc put |
|
mc rb |
|
mc ready |
|
mc replicate addmc replicate backlogmc replicate exportmc replicate importmc replicate lsmc replicate resyncmc replicate rmmc replicate statusmc replicate update |
|
mc retention clearmc retention infomc retention set |
|
mc rm |
|
mc share downloadmc share lsmc share upload |
|
mc sql |
|
mc stat |
|
mc support callhomemc support diagmc support inspectmc support perfmc support profilemc support proxymc support top apimc support top diskmc support top locksmc support upload |
|
mc tag listmc tag removemc tag set |
|
mc tree |
|
mc undo |
|
mc update |
|
mc version enablemc version infomc version suspend |
|
mc watch |
Configuration File
mc uses a
JSON formatted configuration file used for storing certain
kinds of information, such as the aliases <mc alias> for each configured
S3-compatible service.
For Linux and macOS, the default configuration file location is
~/.mc/config.json.
For Windows, mc
attempts to construct a default file path by trying specific environment
variables. If a variable is unset, mc moves to the next variable. If all attempts
fail, mc returns an
error. The following list describes each possible file path location in
the order mc checks
them:
HOME\.mc\config.jsonUSERPROFILE\.mc\config.jsonHOMEDRIVE+HOMEPATH\.mc\config.json
You can use the --config-dir
Certificates
The MinIO Client stores certificates and CAs for deployments to the following paths:
Linux, macOS, and other Unix-like systems:
~/.mc/certs/ # certificates
~/.mc/certs/CAs/ # Certificate Authorities
Windows systems:
C:\Users\[username]\mc\certs\ # certificates
C:\Users\[username]\mc\certs\CAs\ # Certificate Authorities
When creating a new alias <minio-mc-alias>, the MinIO Client fetches
the peer certificate, computes the public key fingerprint, and asks the
user whether to accept the deployment's certificate. If you decide to
trust the certificate, the MinIO Client adds the certificate to the
certificate authority path listed above.
Note
In testing environments, you can bypass the certificate check for
selected MinIO Client commands by passing the --insecure
flag.
Pattern Matching
Some commands and flags allow for pattern matching. When enabled, a pattern can include either of these wildcards for character replacement:
*to represent a string of characters to match, either in the middle or end.?to represent a single character.
For example, refer to the following examples for wildcard uses and their results.
| Pattern | Text | Match Result |
|---|---|---|
abc* |
ab | Match |
abc* |
abd | Not a match |
abc*c |
abcd | Match |
ab*??d |
abxxc | Match |
ab*??d |
abxc | Match |
ab??d |
abxc | Match |
ab??d |
abc | Match |
ab??d |
abcxdd | Not a match |
Global Options
mc
All commands <minio-mc-commands> support the
following global options. You can also define some of these options
using Environment Variables <minio-server-envvar-mc>.
--config-dir
The path to a JSON formatted configuration file that
mc uses for storing
data. See mc-configuration for more information on how mc uses the configuration
file.
Alternatively, set the environment variable MC_CONFIG_DIR.
--debug
Enables verbose output to the console.
For example, the following operation adds verbose output to the mc ls command:
mc --debug ls play
Alternatively, set the environment variable MC_DEBUG.
--disable-pager, --dp
mc RELEASE.2024-04-29T09-56-05Z
Disable the pager functionality of the MinIO Client in the CLI. When
used, output prints to raw STDOUT instead.
--insecure
Disables TLS/SSL certificate verification. Allows TLS connectivity to servers with invalid certificates. Exercise caution when using this option against untrusted S3 hosts.
Alternatively, set the environment variable MC_INSECURE.
--json
Enables JSON lines formatted output to the console.
For example, the following operation adds JSON Lines output to the
mc ls command:
mc --json ls play
Alternatively, set the environment variable MC_JSON.
--no-color
Disables the built-in color theme for console output. Useful for dumb terminals.
Alternatively, set the environment variable MC_NO_COLOR.
--quiet
Suppresses console output.
Alternatively, set the environment variable MC_QUIET.
--resolve
mc RELEASE.2024-08-13T05-33-17Z
Creates a custom DNS mapping to resolve a HOST to a specified IP address.
Use the following syntax:
--resolve HOST[:PORT]=IP
For example:
mc alias set --resolve myminio.example.com:9000=192.168.188.118 'myminio' 'https://myminio.example.com:9000' 'miniouser' 'miniosecret'
Repeat the flag multiple times to add additional custom DNS mappings.
--version
Displays the current version of mc.
--help
Displays a summary of command usage on the terminal.
/reference/minio-mc/minio-client-settings /reference/minio-mc/mc-alias /reference/minio-mc/mc-anonymous /reference/minio-mc/mc-batch /reference/minio-mc/mc-cat /reference/minio-mc/mc-cp /reference/minio-mc/mc-diff /reference/minio-mc/mc-du /reference/minio-mc/mc-encrypt /reference/minio-mc/mc-event /reference/minio-mc/mc-find /reference/minio-mc/mc-get /reference/minio-mc/mc-head /reference/minio-mc/mc-idp-ldap /reference/minio-mc/mc-idp-ldap-accesskey /reference/minio-mc/mc-idp-ldap-accesskey-create-with-login /reference/minio-mc/mc-idp-ldap-policy /reference/minio-mc/mc-idp-openid /reference/minio-mc/mc-ilm /reference/minio-mc/mc-legalhold /reference/minio-mc/mc-license /reference/minio-mc/mc-ls /reference/minio-mc/mc-mb /reference/minio-mc/mc-mirror /reference/minio-mc/mc-mv /reference/minio-mc/mc-od /reference/minio-mc/mc-ping /reference/minio-mc/mc-pipe /reference/minio-mc/mc-put /reference/minio-mc/mc-rb /reference/minio-mc/mc-ready /reference/minio-mc/mc-replicate /reference/minio-mc/mc-retention /reference/minio-mc/mc-rm /reference/minio-mc/mc-share /reference/minio-mc/mc-sql /reference/minio-mc/mc-stat /reference/minio-mc/mc-support /reference/minio-mc/mc-tag /reference/minio-mc/mc-tree /reference/minio-mc/mc-undo /reference/minio-mc/mc-update /reference/minio-mc/mc-version /reference/minio-mc/mc-watch