All Products
Search
Document Center

Object Storage Service:cat

Last Updated:Jul 31, 2024

Displays the content of the specified object in the bucket to the screen.

Usage notes

To view object content, you must have the oss:GetObject permission. For more information, see Attach a custom policy to a RAM user.

Command syntax

ossutil cat oss://bucket/object [flags]

Parameter

Type

Description

--count

int

Displays the specified number of characters. Default value: -1.

--encoding-type

string

The encoding type of the object name. Valid values: url.

--head

int

Displays only the first N characters.

--offset

int

The start position of the display.

--request-payer

string

The payer of the request. If pay-by-requester is enabled for the bucket, set this parameter to requester. Valid value: requester.

--tail

int

Displays only the last N characters.

--version-id

string

The version ID of the object.

Note

For more information, see Command-line options.

Examples

  • Display the content of the example.txt object in the examplebucket bucket to the screen.

    ossutil cat oss://examplebucket/example.txt
  • Display the first 10 characters.

    ossutil cat oss://examplebucket/example.txt --head 10
  • Display the last 10 characters.

    ossutil cat oss://examplebucket/example.txt --tail 10
  • Display 20 characters starting at position 10.

    ossutil cat oss://examplebucket/example.txt --offset 10 --count 20
  • Display characters from position 10 to the end.

    ossutil cat oss://examplebucket/example.txt --offset 10