[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["難以理解","hardToUnderstand","thumb-down"],["資訊或程式碼範例有誤","incorrectInformationOrSampleCode","thumb-down"],["缺少我需要的資訊/範例","missingTheInformationSamplesINeed","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-09-04 (世界標準時間)。"],[],[],null,["# Use Cloud Shell with the gcloud CLI\n\nIf you have the [gcloud CLI installed](/sdk/install), you can interact\nwith Cloud Shell from your terminal and use it as a sandbox and a\nportable development environment. This provides the convenience of working\nwith Cloud Shell resources, whether to quickly test an operation\nor use an IDE of your choice to edit a file saved on your\nCloud Shell instance from your local desktop.\n\nUse `gcloud cloud-shell`\n------------------------\n\nThe current `gcloud cloud-shell` command group offering provides the following\nfunctionality:\n\n- Establishing an interactive SSH session with Cloud Shell using [`gcloud cloud-shell ssh`](/sdk/gcloud/reference/cloud-shell/ssh).\n- Copy files between your local and Cloud Shell machine via [scp](/sdk/gcloud/reference/cloud-shell/scp).\n- Mount your Cloud Shell directory to your local file system via [sshfs](/sdk/gcloud/reference/cloud-shell/get-mount-command).\n\nFor more detail, see the reference documentation for\n[`gcloud cloud-shell`](/sdk/gcloud/reference/cloud-shell).\n| **Note:** To propagate your credentials to your Cloud Shell when starting it from the Google Cloud CLI, use the [`--authorize-session`](/sdk/gcloud/reference/cloud-shell/ssh#--authorize-session) flag when running the `gcloud cloud-shell ssh` command.\n\nExample workflow\n----------------\n\nTo illustrate the workings of `gcloud cloud-shell`, here is an example of how\nyou can use these commands in practice:\n\n1. Start a SSH session:\n\n gcloud cloud-shell ssh\n\n2. Copy a file, `data.txt`, from Cloud Shell to your local machine:\n\n gcloud cloud-shell scp cloudshell:~/data.txt localhost:~data.txt\n\n3. If you're using Mac or Linux, you can mount your Cloud Shell home\n directory onto your local file system after installing\n [sshfs](https://github.com/libfuse/sshfs).\n\n This allows you to edit the files in your Cloud Shell home directory using\n your choice of local tools. All the data in your remotely mounted file\n system is stored on a [Persistent Disk](/persistent-disk)\n and stored across sessions. \n\n gcloud cloud-shell get-mount-command ~/my-cloud-shell"]]