mirror of
https://github.com/imjasonh/gcloud-help
synced 2026-07-08 10:35:03 +00:00
119 lines
4.4 KiB
Text
119 lines
4.4 KiB
Text
NAME
|
|
gcloud alpha storage ls - list Cloud Storage buckets and objects
|
|
|
|
SYNOPSIS
|
|
gcloud alpha storage ls [PATH ...] [--all-versions, -a] [--buckets, -b]
|
|
[--etag, -e] [--readable-sizes] [--recursive, -R, -r]
|
|
[--full, -L | --json, -j | --long, -l] [GCLOUD_WIDE_FLAG ...]
|
|
|
|
DESCRIPTION
|
|
(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.
|
|
|
|
EXAMPLES
|
|
The following command lists the buckets in the default project:
|
|
|
|
$ 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 .txt objects that begin with
|
|
log and that are stored in buckets in your project that begin with my-b:
|
|
|
|
$ gcloud alpha storage ls gs://my-b*/log*.txt
|
|
|
|
The following wildcards are valid and match only within the current
|
|
directory:
|
|
|
|
*: Matches zero or more characters
|
|
?: Matches zero or one characters
|
|
[]: Matches a character range (ex. [a-z] or [0-9])
|
|
|
|
You can use double-star wildcards to match zero or more directory levels in
|
|
a path. The following command matches all .txt objects in a bucket.
|
|
|
|
$ gcloud alpha storage ls gs://my-bucket/**/*.txt
|
|
|
|
Double-star expansion can not be combined with other expressions in a given
|
|
path segment and operates as a single star in that context. For example:
|
|
|
|
gs://my-bucket/dir**/log.txt is treated as:
|
|
|
|
gs://my-bucket/dir*/log.txt and instead should be written as:
|
|
|
|
gs://my-bucket/dir*/**/log.txt to get the recursive behavior.
|
|
|
|
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.
|
|
|
|
POSITIONAL ARGUMENTS
|
|
[PATH ...]
|
|
The path of objects and directories to list. The path must begin with
|
|
gs:// and is allowed to contain wildcard characters.
|
|
|
|
FLAGS
|
|
--all-versions, -a
|
|
Include non-current object versions in the listing. This flag is
|
|
typically only useful for buckets with object versioning
|
|
(https://cloud.google.com/storage/docs/object-versioning) enabled. If
|
|
combined with the --long option, the metageneration for each listed
|
|
object is also included.
|
|
|
|
--buckets, -b
|
|
When given a bucket URL, only return buckets. Useful for avoiding the
|
|
rule that prints the top-level objects of buckets matching a query.
|
|
Typically used in combination with --full to get the full metadata of
|
|
buckets.
|
|
|
|
--etag, -e
|
|
Include ETag metadata in listings that use the --long flag.
|
|
|
|
--readable-sizes
|
|
When used with --long, print object sizes in human readable format,
|
|
such as 1 KiB, 234 MiB, or 2 GiB.
|
|
|
|
--recursive, -R, -r
|
|
Recursively list the contents of any directories that match the path
|
|
expression.
|
|
|
|
At most one of these can be specified:
|
|
|
|
--full, -L
|
|
List all available metadata about items in rows.
|
|
|
|
--json, -j
|
|
List all available metadata about items as a JSON dump.
|
|
|
|
--long, -l
|
|
For objects only. List size in bytes, creation time, and URL. Note:
|
|
Creation time not available for S3.
|
|
|
|
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 command is currently in alpha and might change without notice. If this
|
|
command fails with API permission errors despite specifying the correct
|
|
project, you might be trying to access an API with an invitation-only early
|
|
access allowlist.
|
|
|