Welcome to the upcoming version of the MinIO Documentation! The content on this page is under active development and may change at any time. If you can't find what you're looking for, check our legacy documentation. Thank you for your patience.

mc ls

Description

The mc ls command lists all buckets and objects on the target S3-compatible service. For targets on a filesystem, mc ls has the same functionality as the ls command.

Examples

List Bucket Contents

Use mc ls to list the contents of a bucket:

mc ls [--recursive] ALIAS/PATH
  • Replace ALIAS with the alias of the S3-compatible host.

  • Replace PATH with the path to the bucket on the S3-compatible host.

    If specifying the path to the S3 root (ALIAS only), include the --recursive option.

List Object Versions

Use mc ls --versions to list all versions of an object:

mc ls --versions ALIAS/PATH
  • Replace ALIAS with the alias of the S3-compatible host.

  • Replace PATH with the path to the bucket or object on the S3-compatible host.

Requires Versioning

mc ls requires bucket versioning to use this feature. Use mc version to enable versioning on a bucket.

List Bucket Contents at Point in Time

Use mc ls --versions to list all versions of an object:

mc ls --rewind DURATION ALIAS/PATH
  • Replace ALIAS with the alias of the S3-compatible host.

  • Replace PATH with the path to the bucket or object on the S3-compatible host.

  • Replace DURATION with the point-in-time in the past at which the command returns the object. For example, specify 30d to return the version of the object 30 days prior to the current date.

Requires Versioning

mc ls requires bucket versioning to use this feature. Use mc version to enable versioning on a bucket.

Syntax

mc ls has the following syntax:

mc ls [FLAGS] TARGET [TARGET ...]

mc ls supports the following arguments:

TARGET

Required The full path to one or more locations whose contents the command lists.

  • To list the root contents of an S3-compatible service, specify the alias of that service. For example: mc ls play

  • To list the contents of a bucket on an S3-compatible service, specify the alias of that service as a prefix to the bucket. For example: mc ls play/mybucketname.

  • To list the contents of a directory on a filesystem, specify the path to that directory. For example: mc ls ~/Documents.

If specifying multiple TARGET locations, mc ls collates the contents of each location sequentially.

--recursive, --r

Recursively lists the contents of each bucket or directory in the TARGET.

--versions

Directs mc ls to operate on all object versions that exist in the bucket.

--versions requires that the specified --TARGET be an S3-compatible service that supports Bucket Versioning. For MinIO deployments, use mc version to enable or disable bucket versioning.

Use --versions and --rewind together to display on those object versions which existed at a specific point in time.

--rewind

Directs mc ls to operate only on the object version(s) that existed at specified point-in-time.

  • To rewind to a specific date in the past, specify the date as an ISO8601-formatted timestamp. For example: --rewind "2020.03.24T10:00".

  • To rewind a duration in time, specify the duration as a string in #d#hh#mm#ss format. For example: --rewind "1d2hh3mm4ss".

--rewind requires that the specified --TARGET be an S3-compatible service that supports Bucket Versioning. For MinIO deployments, use mc version to enable or disable bucket versioning.

Use --rewind and --versions together to display on those object versions which existed at a specific point in time.

--incomplete, ---I

Returns any incomplete uploads on the specified TARGET bucket.