The du command is used to query the capacity of a specified bucket or the size of a specified object or folder.

Note The commands described in this topic apply to Linux. To use the commands in other systems, replace ./ossutil in the command with the actual executable program name. For example, you can use the help command in 32-bit Windows systems by running ossutil32.exe help.

Command syntax

./ossutil du oss://bucket[/prefix] [--payer requester] [--all-versions]

Examples

  • Query the capacity of a specified bucket
    ./ossutil du oss://bucket1
    storage class   object count            sum size(byte)
    ----------------------------------------------------------
    Standard        6                       66057605
    ----------------------------------------------------------
    total object count: 6                           total object sum size: 66057605
    total part count:   0                           total part sum size:   0
    
    total du size(byte):66057605
  • View the size of a specified folder
    ./ossutil du oss://bucket1/test/
    storage class   object count            sum size(byte)
    ----------------------------------------------------------
    Standard        3                       18325825
    ----------------------------------------------------------
    total object count: 3                           total object sum size: 18325825
    total part count:   0                           total part sum size:   0
    
    total du size(byte):18325825
  • View the size of a specified object
    ./ossutil du oss://bucket1/test.txt
    storage class   object count            sum size(byte)
    ----------------------------------------------------------
    Standard        1                       8887851
    ----------------------------------------------------------
    total object count: 1                           total object sum size: 8887851
    total part count:   0                           total part sum size:   0
    
    total du size(byte):8887851
  • View the size of all objects whose names start with a specified prefix
    ./ossutil du oss://bucket1/test
    storage class   object count            sum size(byte)
    ----------------------------------------------------------
    Standard        3                       18325825
    ----------------------------------------------------------
    total object count: 3                           total object sum size: 18325825
    total part count:   0                           total part sum size:   0
    
    total du size(byte):18325825
  • View the size of a specified bucket, including the size of previous versions of objects in the bucket
    ./ossutil du oss://bucket1 --all-versions
    storage class   object count            sum size(byte)
    ----------------------------------------------------------
    Standard        6                       66057605
    ----------------------------------------------------------
    total object count: 6                           total object sum size: 66057605
    total part count:   0                           total part sum size:   0
    
    total du size(byte):66057605

Common options

The following table describes the options you can add to the du command.
Option Description
--loglevel Specifies the log level. The default value is null, which indicates that no log files are generated. Valid values:
  • info: generates prompt logs.
  • debug: generates detailed logs that contain corresponding HTTP request and response information.
--proxy-host Specifies the URL of the proxy server. HTTP, HTTPS, and SOCKS5 proxies are supported. Examples: http://120.79. **.**:3128 and socks5://120.79. **. **:1080.
--proxy-user Specifies the username of the proxy server. The default value is null.
--proxy-pwd Specifies the password of the proxy server. The default value is null.
--payer Specifies the payer of the request. To enable pay-by-requester, set this option to requester.
--all-versions Specifies all versions of an object.
Note For more information about common options, see View all supported options.