gcloud storage cat

NAME
gcloud storage cat - outputs the contents of one or more URLs to stdout
SYNOPSIS
gcloud storage catURL[URL …][--additional-headers=HEADER=VALUE][--display-url,-d][--range=RANGE,-rRANGE][--decryption-keys=[DECRYPTION_KEY,…]][GCLOUD_WIDE_FLAG]
DESCRIPTION
The cat command outputs the contents of one or more URLs to stdout. While thecat command does not compute a checksum, it is otherwise equivalent to doing:
gcloudstoragecpurl…-

(The final '-' causes gcloud to stream the output to stdout.)

EXAMPLES
The following command writes all text files in a bucket to stdout:
gcloudstoragecatgs://bucket/*.txt

The following command outputs a short header describing file.txt, along with itscontents:

gcloudstoragecat-dgs://my-bucket/file.txt

The following command outputs bytes 256-939 of file.txt:

gcloudstoragecat-r256-939gs://my-bucket/file.txt

The following command outputs the last 5 bytes of file.txt:

gcloudstoragecat-r-5gs://my-bucket/file.txt
POSITIONAL ARGUMENTS
URL [URL …]
The url of objects to list.
FLAGS
--additional-headers=HEADER=VALUE
Includes arbitrary headers in storage API calls. Accepts a comma separated listof key=value pairs, e.g.header1=value1,header2=value2. Overridesthe defaultstorage/additional_headers property value for thiscommand invocation.
--display-url,-d
Prints the header before each object.
--range=RANGE,-rRANGE
Causes gcloud storage to output just the specified byte range of the object. Ina case where "start" = 'x', and "end" = 'y', ranges take the form:x-y (e.g.,-r 256-5939),x- (e.g.,-r 256-),-y (e.g.,-r -5)

When offsets start at 0, x-y means to return bytes x through y (inclusive), x-means to return bytes x through the end of the object, and -y changes the roleof y. If -y is present, then it returns the last y bytes of the object.

If the bytes are out of range of the object, then nothing is printed

ENCRYPTION FLAGS
--decryption-keys=[DECRYPTION_KEY,…]
A comma-separated list of customer-supplied encryption keys (RFC 4648 section 4base64-encoded AES256 strings) that will be used to decrypt Cloud Storageobjects. Data encrypted with a customer-managed encryption key (CMEK) isdecrypted automatically, so CMEKs do not need to be listed here.
GCLOUD WIDE FLAGS
These flags are available to all commands:--access-token-file,--account,--billing-project,--configuration,--flags-file,--flatten,--format,--help,--impersonate-service-account,--log-http,--project,--quiet,--trace-token,--user-output-enabled,--verbosity.

Run$gcloud help for details.

NOTES
This variant is also available:
gcloudalphastoragecat

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-05-07 UTC.