GCP gsutil for GCS

◾️ gsutil command usage

$ gcloud auth login
Your browser has been opened to visit:

    https://accounts.google.com/o/oauth2/auth?response_type=code&client_id=xxxxxx


You are now logged in as [xxx@gmail.com].
Your current project is [learngcp-300907].  You can change this setting by running:
  $ gcloud config set project PROJECT_ID
$ gcloud config set project learngcp-300907
Updated property [core/project].
$ gsutil list
gs://cit007-bucket-1/
$ gsutil ls gs://cit007-bucket-1/
gs://cit007-bucket-1/SEO.jpg
$ gsutil gu gs://cit007-bucket-1/
CommandException: Invalid command "gu".
$ gsutil du gs://cit007-bucket-1/
5788         gs://cit007-bucket-1/SEO.jpg
$ gsutil du -s gs://cit007-bucket-1/
5788         gs://cit007-bucket-1
$ gsutil mb gs://cit007-bucket-2
Creating gs://cit007-bucket-2/...
$ gsutil rb gs://cit007-bucket-2
Removing gs://cit007-bucket-2/...
$ gsutil cp ~/Downloads/python.csv gs://cit007-bucket-1/
Copying file:///Users/intackcho/Downloads/python.csv [Content-Type=text/csv]...
/ [1 files][ 27.9 KiB/ 27.9 KiB]
Operation completed over 1 objects/27.9 KiB.
$ gsutil cp gs://cit007-bucket-1/python.csv ./
Copying gs://cit007-bucket-1/python.csv...
- [1 files][ 27.9 KiB/ 27.9 KiB]
Operation completed over 1 objects/27.9 KiB.
$ ls
account-key	python.csv
$ gsutil mv ~/Downloads/react.csv gs://cit007-bucket-1/
Copying file:///Users/intackcho/Downloads/react.csv [Content-Type=text/csv]...
Removing file:///Users/intackcho/Downloads/react.csv...

Operation completed over 1 objects/27.6 KiB.
$ gsutil mv gs://cit007-bucket-1/react.csv ./
Copying gs://cit007-bucket-1/react.csv...
Removing gs://cit007-bucket-1/react.csv...

Operation completed over 1 objects/27.6 KiB.
$ gsutil ls -L gs://cit007-bucket-1/python.csv
gs://cit007-bucket-1/python.csv:
    Creation time:          Wed, 17 Feb 2021 15:54:41 GMT
    Update time:            Wed, 17 Feb 2021 15:54:41 GMT
    Storage class:          STANDARD
    Content-Language:       en
    Content-Length:         28604
    Content-Type:           text/csv
    Hash (crc32c):          Hc+9Dg==
    Hash (md5):             d9J2/Yzf87N/poE8j8MwdQ==
    ETag:                   CLOCq+Wj8e4CEAE=
    Generation:             1613577281257779
    Metageneration:         1
    ACL:                    [
  {
    "entity": "project-owners-584448154623",
    "projectTeam": {
      "projectNumber": "584448154623",
      "team": "owners"
    },
    "role": "OWNER"
  },
  {
    "entity": "project-editors-584448154623",
    "projectTeam": {
      "projectNumber": "584448154623",
      "team": "editors"
    },
    "role": "OWNER"
  },
  {
    "entity": "project-viewers-584448154623",
    "projectTeam": {
      "projectNumber": "584448154623",
      "team": "viewers"
    },
    "role": "READER"
  },
  {
    "email": "xxx@gmail.com",
    "entity": "user-xxx@gmail.com",
    "role": "OWNER"
  }
]
TOTAL: 1 objects, 28604 bytes (27.93 KiB)

コメントを残す

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です