# Google Storage

![](/files/-LmbdsMvJplFXXyTRcoy)

Flattened 格式 ![](/files/-LmbdsMxumRjFRUeTvWM)

### 一些format的部分

專案清單

```
//全部
gcloud projects list
//JSON格式
gcloud projects list --format=json
//Flattened
gcloud projects list --format=flattened
//長度
gcloud projects list --limit=1
//table
gcloud projects list --format="table[box,title=Projects](name,lifecycleState)"
//csv
gcloud projects list --format="csv[no-heading,separator=''](name,lifecycleState)"
//csv
gcloud projects list --format"csv(name,createTime)"
```

### 一些方法，對齊、日期

運算主機區域清單

```
//清除設定
gcloud config unset project
//列出專案列表
gcloud projects list
//挑選要用的project，輸入project-id
//必須是有啟用 compute.googleapis.com 的 project
gcloud config set project storied-program-213502
//列出清單
gcloud compute instances list

gcloud compute zones list

gcloud compute zones list --format="json(zone.basename():sort=1:label=zone,name)"
//url.basename() =>葉的部分(相對於根目錄)
gcloud compute zones list --format="table[box,title=Zones](id:label=zone_id,selfLink.basename())"
//設定align
gcloud compute zones list --format="table[box,title=Zones](name:sort=1:align=center,region.basename():label=region:sort=2,status)"
//設定日期 %Y 2018 %y 18 %m 11 %d 22 %D 11/22/18
gcloud projects list --format="table[box](name:sort=1:reverse, createTime.date('%d-%m-%Y'))"
```

### filter

```
//region欄位的值 開頭是asia的  ((star 可加可不加，看不出來差別
gcloud compute zones list --filter="region:asia*"

//上一層的類型不是組織的
gcloud projects list --format=json filter="NOT parent.type:organization"

//篩選日期範圍 (但我測試有bug，找出來的結果有  2018*2，2016*1 ，有一個該出現的2017*1 沒有出來)
gcloud projects list --format=json --filter="createTime.date('%d-%m-%Y') > 1-1-2017"
```

![](/files/-LmbdsMzm_2guUFa8UYH)

## gsutil

```
//列出bucket內的東西
gsutil ls -r gs://Bucket_Name

//複製檔案
//gsutil cp 來源 目的
gsutil cp gs://my-bucket ~/
```

## API


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://brianwu.gitbook.io/brian/brians-za-ji/googlestorage/google-storage.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
