Stay organized with collections
Save and categorize content based on your preferences.
If you have the gcloud CLI installed, you can interact
with Cloud Shell from your terminal and use it as a sandbox and a
portable development environment. This provides the convenience of working
with Cloud Shell resources, whether to quickly test an operation
or use an IDE of your choice to edit a file saved on your
Cloud Shell instance from your local desktop.
Use gcloud cloud-shell
The current gcloud cloud-shell command group offering provides the following
functionality:
If you're using Mac or Linux, you can mount your Cloud Shell home
directory onto your local file system after installing
sshfs.
This allows you to edit the files in your Cloud Shell home directory using
your choice of local tools. All the data in your remotely mounted file
system is stored on a Persistent Disk
and stored across sessions.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-28 UTC."],[],[],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"]]