[ Web Proxy ]
URL:
Viewing: https://docs.cloud.google.com/shell/docs/using-cloud-shell-with-gcloud-cli [Back]  [Original]

Use Cloud Shell with the gcloud CLI  |  Google Cloud Documentation Skip to main content
Google Cloud Documentation [Google Cloud Documentation]
Send feedback

Use Cloud Shell with the gcloud CLI 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:

For more detail, see the reference documentation for gcloud cloud-shell.

Note: To propagate your credentials to your Cloud Shell when starting it from the Google Cloud CLI, use the --authorize-session flag when running the gcloud cloud-shell ssh command.

Example workflow

To illustrate the workings of gcloud cloud-shell, here is an example of how you can use these commands in practice:

  1. Start a SSH session:

    gcloud cloud-shell ssh
    
  2. Copy a file, data.txt, from Cloud Shell to your local machine:

    gcloud cloud-shell scp cloudshell:~/data.txt localhost:~data.txt
    
  3. 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.

    gcloud cloud-shell get-mount-command ~/my-cloud-shell
    
Send feedback

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2026-08-11 UTC.

Need to tell us more? [[["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 2026-08-11 UTC."],[],[]]

Web Proxy Viewer  |  New URL  |  Original Page