Stay organized with collections Save and categorize content based on your preferences.
gcloud alpha storage ls
[PATH
…] [--additional-headers
=HEADER
=VALUE
] [--all-versions
, -a
] [--buckets
, -b
] [--etag
, -e
] [--exhaustive
] [--fetch-encrypted-object-hashes
] [--format
=FORMAT
] [--metadata-filter
=METADATA_FILTER
] [--next-page-token
=NEXT_PAGE_TOKEN
] [--read-paths-from-stdin
, -I
] [--readable-sizes
] [--recursive
, -R
, -r
] [--soft-deleted
] [--full
, -L
| --json
, -j
| --long
, -l
] [--decryption-keys
=[DECRYPTION_KEY
,…]] [GCLOUD_WIDE_FLAG …
]
(ALPHA)
List your Cloud Storage buckets in a project and objects in a bucket. This command treats forward slashes in object names as directories. See below for examples of how to use wildcards to get the listing behavior you want.
gcloud alpha storage ls
The following command lists the buckets in the specified project:
gcloud alpha storage ls --project=my-project
The following command lists the contents of a bucket:
gcloud alpha storage ls gs://my-bucket
You can use wildcards to match multiple paths (including multiple buckets). Bucket wildcards are expanded to match only buckets contained in your current project. The following command matches
objects that begin with .txt
and that are stored in buckets in your project that begin with log
:my-b
gcloud alpha storage ls gs://my-b*/log*.txt
You can use double-star wildcards to match zero or more directory levels in a path. The following command matches all
objects in a bucket..txt
gcloud alpha storage ls gs://my-bucket/**/*.txt
The wildcard **
retrieves a flat list of objects in a single API call and does not match prefixes. The following command would not match gs://my-bucket/dir/log.txt
:
gcloud alpha storage ls gs://my-bucket/**/dir
Double-star expansion also can not be combined with other expressions in a given path segment and operates as a single star in that context. For example, the command gs://my-bucket/dir**/log.txt
is treated as gs://my-bucket/dir*/log.txt
. To get the recursive behavior, the command should instead be written the following way:
gs://my-bucket/dir*/**/log.txt
The following command lists all items recursively with formatting by using --recursive
:
gcloud alpha storage ls --recursive gs://bucket
Recursive listings are similar to **
except recursive listings include line breaks and header formatting for each subdirectory.
The following command filters objects based on specified filter while listing. Note that the flag is only supported for Google Cloud Storage URLs and only applies to objects. This means that directories or buckets will still be listed even if they do not contain objects that match the filter.
gcloud alpha storage ls gs://my-bucket --metadata-filter='contexts."foo"="bar"'
PATH
…]
header1=value1,header2=value2
. Overrides the default storage/additional_headers
property value for this command invocation.
--all-versions
, -a
--long
option, the metageneration for each listed object is also included.
--buckets
, -b
--full
to get the full metadata of buckets.
--etag
, -e
--long
flag.
--exhaustive
--fetch-encrypted-object-hashes
--format
=FORMAT
--metadata-filter
=METADATA_FILTER
storage ls
and storage du
will still list directories or buckets even if they do not contain any objects matching the filter. See https://cloud.google.com/storage/docs/listing-objects#filter-by-object-contexts-syntax for more details.
--next-page-token
=NEXT_PAGE_TOKEN
--read-paths-from-stdin
, -I
--readable-sizes
--long
, print object sizes in human readable format, such as 1 KiB, 234 MiB, or 2 GiB.
--recursive
, -R
, -r
--soft-deleted
--full
, -L
--json
, -j
--long
, -l
--decryption-keys
=[DECRYPTION_KEY
,…]
--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.
gcloud storage ls
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 2025-10-07 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-10-07 UTC."],[],[]]
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.5