All Products
Search
Document Center

Object Storage Service:stat

Last Updated:Jul 31, 2024

This topic describes how to run the stat command to query information about buckets or objects. For example, you can run this command to query the storage class of a bucket and the metadata of an object.

Usage notes

Only the bucket owner and RAM users that have the oss:GetObject, oss:GetObjectAcl, and oss:GetBucketInfo permissions are allowed to run the stat command to query object metadata.

Command syntax

ossutil stat oss://bucket[/object] [flags]

Parameter

Type

Description

--encoding-type

string

The encoding method used to encode the object name. Valid value: url.

--human-readable

/

Specifies that information is output in a user-friendly manner to facilitate reading. The unit of object size can be KiB, MiB, GiB, TiB, or PiB.

--request-payer

string

The payer of the request. If pay-by-requester is enabled for the bucket, set this parameter to requester. Valid value: requester.

--version-id

string

The version ID of the object.

Examples

  • Query information about the examplebucket bucket

    ossutil stat oss://examplebucket
  • Query information about the exampleobject.txt object in the examplebucket bucket

    ossutil stat oss://examplebucket/exampleobject.txt 
  • Query information about a specific version of the exampleobject.txt object in the examplebucket bucket for which versioning is enabled

    ossutil stat oss://examplebucket/exampleobject.txt --version-id CAEQKxiBgMCplua..xgiIGFiZjE0NTZkNTU4NjQ5NDdiMDMyMzc4YzIxNDVm****