Updated on 2024-09-03 GMT+08:00

Listing Buckets

Function

You can use this command to obtain the bucket list. In the list, bucket names are displayed in lexicographical order.

Command Line Structure

  • In Windows
    obsutil ls [-s] [-du] [-sc] [-j=1] [-limit=1] [-format=default] [-config=xxx] [-e=xxx] [-i=xxx] [-k=xxx] [-t=xxx]
  • In Linux or macOS
    ./obsutil ls [-s] [-du] [-sc] [-j=1] [-limit=1] [-format=default] [-config=xxx] [-e=xxx] [-i=xxx] [-k=xxx] [-t=xxx]

Examples

  • Take the Windows OS as an example. Run the obsutil ls -limit=5 command to obtain the bucket list.
    obsutil ls -limit=5
    
    Bucket                        CreationDate                  Location         BucketType   
    obs://bucket001               2018-09-03T01:53:02Z          example          OBJECT   
    
    obs://bucket002               2018-11-01T01:40:01Z          example          OBJECT      
    
    obs://bucket003               2018-10-25T11:45:45Z          example          OBJECT       
    
    obs://bucket004               2018-10-26T02:33:09Z          example          OBJECT      
    
    obs://bucket005               2018-10-26T02:34:50Z          example          OBJECT      
             
    Bucket number : 5

Parameter Description

Parameter

Optional or Mandatory

Description

s

Optional (additional parameter)

Displays simplified query result.

NOTE:

In the simplified format, the returned result contains only the bucket name.

sc

Optional (additional parameter)

Queries the storage classes of the buckets when listing buckets.

j

Optional (additional parameter). It must be used together with sc.

Indicates the maximum number of concurrent tasks for querying the bucket storage class. The default value is the value of defaultJobs in the configuration file.

NOTE:

The value is ensured to be greater than or equal to 1.

du

Optional (additional parameter)

Quickly returns the total size of listed objects, without displaying detailed object information. This parameter can be used together with other parameters.

NOTE:

This parameter takes effect only on listing objects, but not on listing buckets.

fs

Optional (additional parameter)

Specifies whether the method of listing parallel file systems is applied. If you are listing parallel file systems, you are recommended to add this parameter.

CAUTION:
  • With this method, the listing time required varies largely depending on the directory structures.
  • After this parameter is enabled, marker and limit will be ignored. Then, the size of the bucket or parallel file system will be calculated.
  • This parameter is only supported by obsutil 5.5.12 and later.

limit

Optional (additional parameter)

Maximum number of buckets that can be queried. If the value is less than 0, all buckets are listed. If it is left blank, a maximum of 1000 buckets can be listed by default.

format

Optional (additional parameter)

Prints a listing result in the user-defined format. Currently, the value can only be default, indicating that the listing result is displayed in one row.

config

Optional (additional parameter)

User-defined configuration file for executing a command. For details about parameters that can be configured, see Configuration Parameters.

e

Optional (additional parameter)

Specifies the endpoint.

i

Optional (additional parameter)

Specifies the user's AK.

k

Optional (additional parameter)

Specifies the user's SK.

t

Optional (additional parameter)

Specifies the user's security token.

In a bucket listing result, BucketType indicates the bucket type. OBJECT indicates an object storage bucket, while POSIX indicates a parallel file system.