全部產品
Search
文件中心

Object Storage Service:命令列選項

更新時間:Sep 09, 2024

命令列選項的優先順序最高,可以覆蓋設定檔設定或環境變數設定的參數。命令列選項分為全域命令列選項和局部命令列選項。全域命令列選項適用於所有命令,局部命令列選項僅適用於特定的命令。

查詢命令列選項

執行以下命令查詢命令列選項:

ossutil cp -h

輸出內容如下:

Flags:
      --acl string                         The access control list (ACL) of the object, valid value(s): "private","public-read","public-read-write","default"
      --bandwidth-limit SizeSuffix         Bandwidth limit in B/s, or use suffix B|K|M|G|T|P
      --bigfile-threshold SizeSuffix       The threshold of file size, the file size larger than the threshold will use multipart upload, download or copy, or use suffix B|K|M|G|T|P (default 100Mi)
      --cache-control string               The caching behavior of the web page when the object is downloaded
      --checkers int                       Number of checkers to run in parallel (default 16)
      --checkpoint-dir string              The specified directory for breakpoint continuation information
      --checksum                           Only copy the source file with different size and checksum(if available)
      --content-disposition string         The method that is used to access the object
      --content-encoding string            The method that is used to encode the object
      --content-type string                The mime type of object
      --copy-props string                  Determines which properties are copied from the source object, valid value(s): "none","metadata","default"
  -d, --dirs                               Return matching subdirectory names instead of contents of the subdirectory
      --encoding-type string               The encoding type of object name or file name that user inputs, valid value(s): "url"
      --end-with string                    The name of the object from which the list operation ends, include
      --exclude stringArray                Exclude files matching pattern
      --exclude-from stringArray           Read exclude patterns from file
      --expires string                     The expiration time of the cache in UTC
      --files-from stringArray             Read list of source-file names from file, ignores blank and comment line
      --files-from-raw stringArray         Read list of source-file names from file without any processing of lines
      --filter stringArray                 A file-filtering rule
      --filter-from stringArray            Read file filtering rules from a file
  -f, --force                              Operate silently without asking user to confirm the operation
      --include stringArray                Don't exclude files matching pattern
      --include-from stringArray           Read include patterns from file
  -j, --job int                            Amount of concurrency tasks between multi-files (default 3)
      --list-objects                       Use ListObjects instead of ListObjectsV2 to list objects
      --max-age Duration                   Don't transfer any file older than this, in s or suffix ms|s|m|h|d|w|M|y (default off)
      --max-mtime Time                     Don't transfer any file younger than this, UTC time format (default off)
      --max-size SizeSuffix                Don't transfer any file larger than size, in B or suffix B|K|M|G|T|P, 1K(KiB)=1024B
      --metadata strings                   Specifies the object's user metadata, in key=value foramt
      --metadata-directive string          The method that is used to configure the metadata of the destination object, valid value(s): "COPY","REPLACE"
      --metadata-exclude stringArray       Exclude metadata matching pattern
      --metadata-filter stringArray        A metadata-filtering rule
      --metadata-filter-from stringArray   Read metadata filtering rules from a file
      --metadata-include stringArray       Don't exclude metadata matching pattern
      --min-age Duration                   Don't transfer any file younger than this, in s or suffix ms|s|m|h|d|w|M|y (default off)
      --min-mtime Time                     Don't transfer any file older than this, UTC time format (default off)
      --min-size SizeSuffix                Don't transfer any file smaller than size, in B or suffix B|K|M|G|T|P, 1K(KiB)=1024B
      --no-error-report                    Don't generate error report file during batch operation
      --no-progress                        The progress is not displayed
      --output-dir string                  Specifies the directory to place output file in, output file contains: error report file generated during batch operation (default "ossutil_output")
      --page-size int                      The number of results to return in each response to a list operation (default 1000), in the range 1 - 1000
      --parallel int                       Amount of concurrency tasks when work with a file
      --part-size SizeSuffix               The part size, calculated the suitable size according to file size by default, or use suffix B|K|M|G|T|P, in the range 100Ki - 5Gi
  -r, --recursive                          Operate recursively, if the option is specified, the command will operate on all match objects under the bucket, else operate on the single object.
      --request-payer string               The payer of the request. set this value if you want pay for requester, valid value(s): "requester"
      --size-only                          Only copy the source file with different size
      --start-after string                 The name of the object from which the list operation starts, not include
      --storage-class string               The storage class of the object, valid value(s): "Standard","IA","Archive","ColdArchive","DeepColdArchive"
      --tagging strings                    Specifies the tag of the destination object, in key=value foramt
      --tagging-directive string           The method that is used to configure tags for the destination object, valid value(s): "COPY","REPLACE"
  -u, --update                             Only copy when the source file is newer than the destination file

Global Flags:
  -i, --access-key-id string        AccessKeyID while access oss
  -k, --access-key-secret string    AccessKeySecret while access oss
      --addressing-style string     The style in which to address endpoints (default "virtual"), valid value(s): "virtual","path","cname"
  -c, --config-file string          The path of the configuration file (default "~/.ossutilconfig")
      --connect-timeout int         The client connection timed out, the unit is: s (default 10)
  -n, --dry-run                     Do a trial run with no permanent changes
  -e, --endpoint string             The domain names that other services can use to access OSS.
  -h, --help                        help for the command
      --language string             The display text language
      --log-file string             Specifies the log output file. When -, outputs to Stdout
      --loglevel string             The debug message level (default "off"), valid value(s): "off","info","debug"
      --mode string                 Specifies the authentication mode, valid value(s): "AK","StsToken","EcsRamRole","Anonymous"
      --output-format string        The formatting style for command output (default "raw")
      --output-properties strings   The properties of output format
      --output-query string         A JMESPath query to use in filtering the response data
      --profile string              Specific profile from your config file.
      --proxy string                Specifies the proxy server. When 'env', use HTTP_PROXY and HTTPS_PROXY environment variables
  -q, --quiet                       Quiet mode, print as little stuff as possible
      --read-timeout int            The client read timed out, the unit is: s (default 20)
      --region string               The region in which the bucket is located.
      --retry-times int             Retry times when fail (default 10)
      --role-arn string             Specifies the ARN of role
      --role-session-name string    Specifies the session name
      --sign-version string         The version of the signature algorithm (default "v4"), valid value(s): "v1","v4"
      --skip-verify-cert            Specifies that the oss server's digital certificate file will not be verified
  -t, --sts-token string            STSToken while access oss

使用命令列選項

在命令列操作中,部分命令需要附加參數以指定操作對象或設定選項,而其他命令則不需要參數。對於帶參數的命令,您可以根據具體要求提供適當的參數值,以實現預期的功能,例如,帶參數的命令如:

ossutil ls --profile dev

ossutil ls --profile dev允許使用者通過參數值dev指定特定的設定檔。帶參數的選項通常需要通過空格或等號(=)將選項名稱與參數值分隔,例如--profile dev--profile=dev。當參數值包含空格時,必須使用雙引號將整個參數值括起來,以確保命令正確解析,例如 --description "OSS bucket list"

支援的全域命令列選項

參數

類型

說明

-i, --access-key-id

string

訪問OSS使用的AccessKey ID。

-k, --access-key-secret

string

訪問OSS使用的AccessKey Secret。

--addressing-style

string

請求地址的格式。取值範圍如下:

  • virtual(預設值),表示虛擬託管模式

  • path,表示路徑模式。

  • cname,表示自訂網域名模式。

-c, --config-file

string

設定檔的路徑。 預設值為~\\.ossutilconfig

--connect-timeout

int

用戶端連線逾時的時間。單位為秒,預設值為10。

-n, --dry-run

/

在不進行任何更改的情況下執行試運行。

-e, --endpoint

string

對外服務的訪問網域名稱。

-h, --help

/

顯示協助資訊。

--language

string

顯示的語言。

--loglevel

string

記錄層級。取值範圍如下:

  • off(預設值)

  • info

  • debug

--mode

string

鑒權模式。取值:

  • AK,表示存取金鑰。

  • StsToken,表示臨時安全憑證。

  • EcsRamRole,表示使用ECS執行個體角色(RAM Role)進行鑒權。

  • Anonymous,表示匿名訪問。

--output-format

string

輸出格式,預設值為raw。

--output-query

string

JMESPath查詢條件。

--profile

string

指定設定檔裡的profile。

-q, --quiet

/

安靜模式,列印儘可能少的資訊。

--read-timeout

int

用戶端讀寫請求逾時時間。單位為秒,預設值為20。

--region

string

資料中心所在的地區,配置值可設定為cn-hangzhou。

--retry-times

int

當錯誤發生時的重試次數。預設值為10。

--sign-version

string

請求使用的簽名演算法版本。取值:

  • v1

  • v4(預設值)

--skip-verify-cert

/

表示不校正服務端的數位憑證。

-t, --sts-token

string

訪問OSS使用的STS Token。

--proxy

string

指定Proxy 伺服器,

配置值可以為以下幾種:

  • 直接配置:可以直接指定Proxy 伺服器的詳細資料,例如:

    • http://proxy.example.com:8080

    • https://proxy.example.com:8443

  • env:表示使用環境變數 HTTP_PROXYHTTPS_PROXY 來擷取Proxy 伺服器資訊。使用者需要在作業系統中配置這兩個環境變數,例如:

    • HTTP_PROXY=http://proxy.example.com:8080

    • HTTPS_PROXY=https://proxy.example.com:8443

    配置這些環境變數後,將Proxy 伺服器選項的值設定為 env,系統將自動使用這些環境變數中的代理設定。

--log-file

string

指定日誌輸出檔案,配置值為:

  • -:表示將日誌輸出到標準輸出(Stdout)。

  • 檔案路徑:指定一個具體的檔案路徑,將日誌輸出到該檔案。

如果未指定日誌輸出檔案,輸出到預設設定檔上。