The cat command is used to export the content of a specified object to ossutil.
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 cat oss://bucket/object [--payer requester]
Note We recommend that you only use this command to view the content of a TXT file.
Examples
- View the contents of a specified object.
./ossutil cat oss://bucket1/test.txt language=ch endpoint=oss-cn-hangzhou.aliyuncs.com 0.273027(s) elapsed
- View a specified version of an object in a bucket that has versioning enabled
To use the./ossutil cat oss://bucket1/test.txt --version-id CAEQARiBgID8rumR2hYiIGUyOTAyZGY2MzU5MjQ5ZjlhYzQzZjNlYTAyZDE3MDRk language=ch endpoint=oss-cn-hangzhou.aliyuncs.com 0.375125(s) elapsed
--version-id
option, you must run the ls --all-versions command to obtain all available versions of the object.Note The--version-id
option can only be used for objects in versioning-enabled buckets. For more information about the command used to enable versioning on a bucket, see bucket-versioning.
Common options
The following table describes the options you can add to the cat command.
Option | Description |
---|---|
--encoding-type | Specifies the method used to encode the object name. If this option is specified, this value must be url. If this option is not specified, the object name is not encoded. Bucket names cannot be URL-encoded. |
--loglevel | Specifies the log level. The default value is null, indicating that no log files are
generated. Valid values:
|
--version-id | Specifies the version ID of an object. The bucket in which the object is located must have versioning enabled. |
--payer | Specifies the payer of the request. To enable pay-by-requester, set this option to requester. |
--proxy-host | Specifies the URL of the proxy server. HTTP, HTTPS, and SOCKS5 proxies are supported. An example of the URL is http://120.79. **.**:3128 or socks5://120.79. **. **:1080. |
--proxy-user | Specifies the username for the proxy server. The default value is null. |
--proxy-pwd | Specifies the password for the proxy server. The default value is null. |
Note For more information about common options, see View all supported options.