All Products
Search
Document Center

Object Storage Service:stat (View bucket and object information)

Last Updated:Mar 20, 2026

Query metadata for a bucket or object using the stat command. Use it to check storage class, access control list (ACL), redundancy type, object size, and other properties directly from the command line.

Important

Only the bucket owner and RAM users with the oss:GetObject, oss:GetObjectAcl, and oss:GetBucketInfo permissions can query object metadata using stat.

Prerequisites

Before you begin, ensure that you have:

  • ossutil installed. For ossutil 1.6.16 and later, use ossutil directly as the binary name. For earlier versions, update the binary name based on your operating system. See ossutil command reference

  • The required permissions to query the bucket or object

Command syntax

ossutil stat oss://bucketname[/objectname]
             [--encoding-type <value>]
             [--payer <value>]
             [--version-id <value>]

Parameters and options

Parameter/OptionRequiredDescription
bucketnameYesName of the bucket.
objectnameNoName of the object. Omit to query bucket-level information.
--encoding-typeNoEncoding format for the object name. Valid value: url. If not specified, the object name is not encoded.
--payerNoSet to requester to make the requester pay the traffic and request fees generated by this operation.
--version-idNoVersion ID of the object. Applies only to versioning-enabled or versioning-suspended buckets.

Examples

Query bucket information

ossutil stat oss://examplebucket

Sample output:

Name              : examplebucket
Location          : oss-cn-hangzhou
CreationDate      : 2021-06-30 16:04:41 +0800 CST
ExtranetEndpoint  : oss-cn-hangzhou.aliyuncs.com
IntranetEndpoint  : oss-cn-hangzhou-internal.aliyuncs.com
ACL               : private
Owner             : 148562088256****
StorageClass      : Standard
RedundancyType    : LRS
AccessMonitor     : Enabled

0.132413(s) elapsed

Output fields:

FieldDescription
NameBucket name.
LocationRegion where the bucket is located.
CreationDateDate and time the bucket was created.
ExtranetEndpointPublic endpoint for accessing the bucket over the internet.
IntranetEndpointInternal endpoint for accessing the bucket within the Alibaba Cloud internal network.
ACLBucket-level access control list (ACL).
OwnerAlibaba Cloud account ID of the bucket owner.
StorageClassStorage class of the bucket.
RedundancyTypeData redundancy type.
AccessMonitorWhether access monitoring is enabled for the bucket.

Query object information

ossutil stat oss://examplebucket/exampleobject.jpg

Sample output:

ACL                   : default
Accept-Ranges         : bytes
Content-Length        : 8746
Content-Md5           : cvc5wcklut76CVoEi2UW****
Content-Type          : image/jpeg
Etag                  : 72F739C1C925BADEFA095A048B65****
Last-Modified         : 2021-07-27 09:53:03 +0800 CST
Owner                 : 148562088256****
X-Oss-Hash-Crc64ecma  : 56037670485008****
X-Oss-Object-Type     : Normal
X-Oss-Storage-Class   : Standard

0.194739(s) elapsed

Output fields:

FieldDescription
ACLObject-level ACL. default means the object inherits the bucket ACL.
Accept-RangesIndicates the server supports range requests (bytes).
Content-LengthObject size in bytes.
Content-Md5Base64-encoded MD5 hash of the object content, used for data integrity verification.
Content-TypeMIME type of the object.
EtagEntity tag that identifies a specific version of the object. Changes when the object content changes.
Last-ModifiedDate and time the object was last modified.
OwnerAlibaba Cloud account ID of the object owner.
X-Oss-Hash-Crc64ecmaCRC64 checksum of the object, used for end-to-end data integrity verification.
X-Oss-Object-TypeUpload type used to create the object. Normal indicates a standard (non-multipart) upload.
X-Oss-Storage-ClassStorage class of the object.

Query an object with special characters in its name

ossutil supports only URL encoding for object names. To query an object whose name contains special characters, encode the name as URL-safe characters first.

For example, to query the 示例.txt object:

ossutil stat oss://examplebucket/%E7%A4%BA%E4%BE%8B.txt --encoding-type url

Sample output:

ACL                   : default
Accept-Ranges         : bytes
Content-Length        : 113089
Content-Md5           : mAYgHM5cSkZNBxKDDqqW****
Content-Type          : image/jpeg
Etag                  : 9806201CCE5C4A464D0712830EAA****
Last-Modified         : 2021-07-27 10:08:57 +0800 CST
Owner                 : 148562088256****
X-Oss-Hash-Crc64ecma  : 1106061527435521****
X-Oss-Object-Type     : Normal
X-Oss-Storage-Class   : Standard

0.168335(s) elapsed

Query a specific object version

ossutil stat oss://examplebucket/test.jpg --version-id CAEQFRiBgICw.YSX1xciIDNiNzc3ZTdmNTQzOTQ1OTM4MWUwOWI1Y2M1ZTgz****

Sample output:

ACL                   : default
Accept-Ranges         : bytes
Content-Length        : 190540
Content-Md5           : aJQnxHQ2b+zW6hh0c+2y****
Content-Type          : image/jpeg
Etag                  : 689427C474366FECD6EA187473ED****
Last-Modified         : 2021-07-27 10:19:25 +0800 CST
Owner                 : 148562088256****
X-Oss-Hash-Crc64ecma  : 1666171672179499****
X-Oss-Object-Type     : Normal
X-Oss-Storage-Class   : Standard
X-Oss-Version-Id      : CAEQFRiBgICw.YSX1xciIDNiNzc3ZTdmNTQzOTQ1OTM4MWUwOWI1Y2M1ZTgz****

0.213528(s) elapsed

The output includes X-Oss-Version-Id in addition to the standard object fields. To look up the version ID first, see ls.

Cross-account and cross-region queries

To query a bucket in a different region or owned by a different Alibaba Cloud account, add the -e, -i, and -k options to specify the endpoint, AccessKey ID, and AccessKey secret:

ossutil stat oss://testbucket \
  -e oss-cn-shanghai.aliyuncs.com \
  -i yourAccessKeyID \
  -k yourAccessKeySecret

For a full list of common options, see Common options.