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

Command syntax

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

Examples

  • Query the capacity of a specify bucket
    ./ossutil du oss://bucket1
    object count:9  object sum size:471075
    part count:0    part sum size:0
    total du size(byte):471075
  • View the size of a specified folder
    ./ossutil du oss://bucket1/test/
    object count:2  object sum size:64482
    part count:0    part sum size:0
    total du size(byte):64482
    
    0.176018(s) elapsed
  • View the size of a specified object
    ./ossutil du oss://bucket1/test.txt
    object count:1  object sum size:27856
    part count:0    part sum size:0
    total du size(byte):27856
    
    0.241024(s) elapsed
  • View the size of all objects whose names start with a specified prefix
    ./ossutil du oss://bucket1/test
    object count:3  object sum size:92338
    part count:0    part sum size:0
    total du size(byte):92338
    
    0.184018(s) elapsed

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, indicating 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 are supported. An example of the URL is http://120.79. **.**:3128 or 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 the pay-by-requester mode, set this option to requester.
Note For more information about common options, see View all supported options.