key list

Definition

Lists information about all keys in a given volume, bucket, or snapshot.

Usage

$ ozone sh key list [-hV] [-p=<prefix>]
                          [-s=<startItem>]
                          [[-l=<limit>] | [-a]]
                          <value>
NOTE
In this command, list can be shortened to just ls.
Arguments
Parameter Description

value

URI of a volume or bucket. It can be a full URI (starts with o3://, e.g. o3://hostname:9862/vol1/bucket1) or a short URI (starts with a volume name, e.g. vol1/bucket1). Any missing information is obtained from the configuration files

prefix

A name prefix to filter the items

startItem

The item to start listing from. The chosen item will not appear in the results

limit

Maximum number of the results to list. The default value is 100

-a, --all

If specified, the command will display all the results. By default, it is specified. To counter it, use the -l parameter

-h, --help

Prints out a help manual for this command

-V, --version

Prints out version information and exits

Examples

Consider a volume vol1 with a bucket bucket1 created within. That bucket has two keys: key1 and key2. To list information about all the keys, call the following command

$ ozone sh key list vol1/bucket1

The output depends on key configuration, but overall should be similar to the following:

[ {
  "volumeName" : "vol1",
  "bucketName" : "bucket1",
  "name" : "key1",
  "dataSize" : 14,
  "creationTime" : "2025-02-23T21:14:28.098Z",
  "modificationTime" : "2025-02-23T21:17:20.170Z",
  "replicationConfig" : {
    "replicationFactor" : "ONE",
    "requiredNodes" : 1,
    "replicationType" : "RATIS"
  },
  "metadata" : { },
  "file" : true
}, {
  "volumeName" : "vol1",
  "bucketName" : "bucket1",
  "name" : "key2",
  "dataSize" : 14,
  "creationTime" : "2025-02-23T22:16:35.235Z",
  "modificationTime" : "2025-02-23T22:16:36.399Z",
  "replicationConfig" : {
    "replicationFactor" : "ONE",
    "requiredNodes" : 1,
    "replicationType" : "RATIS"
  },
  "metadata" : { },
  "file" : true
} ]

Now, consider that a new key newkey was added to the bucket. To find it among the numerous keys using the list command, you can utilize the prefix search:

$ ozone sh key list vol1/bucket1 -p="new"

The output would be:

[ {
  "volumeName" : "vol1",
  "bucketName" : "bucket1",
  "name" : "newkey",
  "dataSize" : 14,
  "creationTime" : "2025-02-23T22:38:35.625Z",
  "modificationTime" : "2025-02-23T22:38:36.695Z",
  "replicationConfig" : {
    "replicationFactor" : "ONE",
    "requiredNodes" : 1,
    "replicationType" : "RATIS"
  },
  "metadata" : { },
  "file" : true
} ]
Found a mistake? Seleсt text and press Ctrl+Enter to report it