cat - Concatenate object content to stdout

cat - Concatenate object content to stdout

Synopsis

gsutil cat [-h] url...

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 doing:

gsutil cp url... -

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

Warning: Data Integrity Checking Not Done

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 are 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.

Monitor your resources on the go

Get the Google Cloud Console app to help you manage your projects.

Send feedback about...

Cloud Storage Documentation