This page shows you how to list the Cloud Storage buckets in a project, which are ordered in the list lexicographically by name. For an overview of buckets, read the Key Terms.
To list the buckets in a project:
Console
- In the Google Cloud Console, go to the Cloud Storage Browser page.
Buckets that are part of the currently selected project appear in the browser list.
Optionally, use filtering to narrow the results in your list.
gsutil
Use the gsutil ls
command:
gsutil ls
The response looks like the following example:
gs://BUCKET_NAME1/ gs://BUCKET_NAME2/ gs://BUCKET_NAME3/ ...
Code samples
For more information, see the
Cloud Storage C++ API reference documentation.
For more information, see the
Cloud Storage C# API reference documentation.
For more information, see the
Cloud Storage Go API reference documentation.
For more information, see the
Cloud Storage Java API reference documentation.
For more information, see the
Cloud Storage Node.js API reference documentation.
For more information, see the
Cloud Storage PHP API reference documentation.
For more information, see the
Cloud Storage Python API reference documentation.
For more information, see the
Cloud Storage Ruby API reference documentation.
C++
C#
Go
Java
Node.js
PHP
Python
Ruby
REST APIs
JSON API
- Get an authorization access token from the OAuth 2.0 Playground. Configure the playground to use your own OAuth credentials.
Use
cURL
to call the JSON API with aGET
Service request:curl -X GET -H "Authorization: Bearer OAUTH2_TOKEN" \ "https://storage.googleapis.com/storage/v1/b?project=PROJECT_ID"
Where:
OAUTH2_TOKEN
is the access token you generated in Step 1.PROJECT_ID
is the ID of the project containing the buckets you want to list. For example,my-project
.
You can use a
prefix=PREFIX
query string parameter to limit results to buckets that have the specified prefix.
XML API
- Get an authorization access token from the OAuth 2.0 Playground. Configure the playground to use your own OAuth credentials.
Use
cURL
to call the XML API with aGET
Service request:curl -X GET -H "Authorization: Bearer OAUTH2_TOKEN" \ -H "x-goog-project-id: PROJECT_ID" \ "https://storage.googleapis.com"
Where:
OAUTH2_TOKEN
is the access token you generated in Step 1.PROJECT_ID
is the ID of the project containing the buckets you want to list. For example,my-project
.
You can use a
prefix=PREFIX
query string parameter to limit results to buckets that have the specified prefix.
What's next
- Get information about a bucket.
- List the objects in a bucket.
- Move or rename a bucket.
- Delete a bucket.