1
0
mirror of https://github.com/minio/docs.git synced 2025-04-27 18:36:56 +03:00
2022-09-16 16:40:20 -04:00

5.6 KiB

mc head

minio

Table of Contents

mc head

Syntax

The mc head command displays the first n lines of an object, where n is an argument specified to the command.

mc head does not perform any transformation or formatting of object contents to facilitate readability. You can also use mc head against the local filesystem to produce similar results to the head commandline tool.

EXAMPLE

The following command returns the first 10 lines of an object in the mydata bucket on the myminio MinIO deployment:

mc head myminio/mydata/myobject.txt

SYNTAX

The command has the following syntax:

mc [GLOBALFLAGS] head                     \
                 [--lines int]            \
                 [--rewind "string"]      \
                 [--version-id "string"]  \
                 [--encrypt-key "string"] \
                 ALIAS [ALIAS ...]

Parameters

ALIAS

Required The object or objects to print.

For an object on MinIO, specify the alias <alias> and the full path to that object (e.g. bucket and path to object). For example:

mc head play/mybucket/object.txt

You can specify multiple objects on the same or different MinIO deployments. For example:

mc head ~/mydata/object.txt myminio/mydata/object.txt

For an object on a local filesystem, specify the full path to that object. For example:

mc head ~/mydata/object.txt

--lines, n

Optional The number of lines to print.

Defaults to 10.

--encrypt-key

Optional Encrypt or decrypt objects using server-side encryption with client-specified keys. Specify key-value pairs as KEY=VALUE.

  • Each KEY represents a bucket or object.
  • Each VALUE represents the data key to use for encrypting

    object(s).

Enclose the entire list of key-value pairs passed to ~mc head --encrypt-key in double quotes ".

~mc head --encrypt-key can use the MC_ENCRYPT_KEY environment variable for retrieving a list of encryption key-value pairs as an alternative to specifying them on the command line.

--rewind

--version-id, vid

Global Flags

Examples

View Partial Contents of an Object

Use mc head to return the first 10 lines of an object:

mc head ALIAS/PATH
  • Replace ALIAS <mc head ALIAS> with the alias <mc alias> of the S3-compatible host.
  • Replace PATH <mc head ALIAS> with the path to the object on the S3-compatible host.

View Partial Contents of an Object at a Point in Time

Use mc head --rewind to return the first 10 lines of the object at a specific point-in-time in the past:

mc head ALIAS/PATH --rewind DURATION
  • Replace ALIAS <mc head ALIAS> with the alias <mc alias> of the S3-compatible host.
  • Replace PATH <mc head ALIAS> with the path to the object on the S3-compatible host.
  • Replace DURATION <mc head --rewind> 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.

View Partial Contents of an Object with Specific Version

Use mc head --version-id to return the first 10 lines of the object at a specific point-in-time in the past:

mc head ALIAS/PATH --version-id VERSION
  • Replace ALIAS <mc head ALIAS> with the alias <mc alias> of the S3-compatible host.
  • Replace PATH <mc head ALIAS> with the path to the object on the S3-compatible host.
  • Replace VERSION <mc head --version-id> with the version of the object. For example, specify 30d to return the version of the object 30 days prior to the current date.

Behavior

S3 Compatibility