Send feedback
Stay organized with collections
Save and categorize content based on your preferences.
cat - Concatenate object content to stdout
Important: gsutil is not the recommended CLI for
Cloud Storage. Use
gcloud storage
commands in the Google Cloud CLI instead.
Synopsis
Description
The cat command outputs the contents of one or more URLs to stdout.
While the cat command does not compute a checksum, it is otherwise
equivalent to the following gsutil cp
command, which uses the final dash (-
) to stream the output to stdout:
Warning : The gsutil cat command does not compute a checksum of the
downloaded data. Therefore, we recommend that users either perform
their own validation of the output of gsutil cat or use gsutil cp
or rsync (both of which perform integrity checking automatically).
Options
-h
Prints short header for each object. For example:
gsutil cat -h gs://bucket/meeting_notes/2012_Feb/*.txt
This would print a header with the object name before the contents
of each text object that matched the wildcard.
-r range
Causes gsutil to output just the specified byte range of the
object. Ranges can be of these forms:
start-end (e.g., -r 256-5939)
start- (e.g., -r 256-)
-numbytes (e.g., -r -5)
where offsets start at 0, start-end means to return bytes start
through end (inclusive), start- means to return bytes start
through the end of the object, and -numbytes means to return the
last numbytes of the object. For example:
gsutil cat -r 256-939 gs://bucket/object
returns bytes 256 through 939, while:
gsutil cat -r -5 gs://bucket/object
returns the final 5 bytes of the object.
Send feedback
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License , and code samples are licensed under the Apache 2.0 License . For details, see the Google Developers Site Policies . Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-08-21 UTC.
[{
"type": "thumb-down",
"id": "hardToUnderstand",
"label":"Hard to understand"
},{
"type": "thumb-down",
"id": "incorrectInformationOrSampleCode",
"label":"Incorrect information or sample code"
},{
"type": "thumb-down",
"id": "missingTheInformationSamplesINeed",
"label":"Missing the information/samples I need"
},{
"type": "thumb-down",
"id": "otherDown",
"label":"Other"
}]
[{
"type": "thumb-up",
"id": "easyToUnderstand",
"label":"Easy to understand"
},{
"type": "thumb-up",
"id": "solvedMyProblem",
"label":"Solved my problem"
},{
"type": "thumb-up",
"id": "otherUp",
"label":"Other"
}]
Need to tell us more?
{
"lastModified": "Last updated 2024-08-21 UTC.",
"confidential": False
}