This page describes the variety of ways you can configure Cloud Shell to customize your experience.
Configuration files in your Cloud Shell home directory
Cloud Shell provisions 5 GB of free
persistent disk storage mounted as
$HOME directory. All files you store in your home directory, including
installed software, scripts and user configuration files like
.vimrc, persist between sessions.
.bashrc persists across sessions, it's a great way to customize
your Cloud Shell behavior. Similarly, you can install packages into your home
directory to have your installations persist.
Pre-configured environment variables
When Cloud Shell is started, the active project in Console is propagated to
gcloud configuration inside Cloud Shell for immediate use.
GOOGLE_CLOUD_PROJECT, the environmental variable used by
Application Default Credentials library support to define project ID, is also
set to point to the active project in Console.
CLOUD_SHELL environment variable is set to
true. This variable can be
checked from applications to determine if an application is running in Cloud Shell.
gcloud command-line tool preferences
To set the project you'd like to work on, run:
gcloud config set project [PROJECT_NAME]
Your command prompt will be updated to reflect your currently active project and
will respect this format:
To select your preferred region, run:
gcloud config set compute/region us-east1
The commands above are examples of gcloud command-line tool configurations you can set; for a full list and greater detail about setting properties, refer to the Cloud SDK properties guide.
Environment customization allows you to install additional packages into your Cloud Shell environment when it starts.
Environment customization script
Cloud Shell automatically runs the script,
when your instance boots up. Unlike
.bashrc, this script runs
once when Cloud Shell boots (rather than once for each shell login).
This script runs as root and you can install any packages that you want to exist in each Cloud Shell session using Debian package management commands.
For example, if you'd like to have erlang installed on Cloud Shell,
.customize_environment file will look like this:
#!/bin/sh apt-get update apt-get -y install erlang
Execution logs of your
.customize_environment script can be found
script runs as a background process and on successful execution, will touch
/google/devshell/customize_environment_done. Because package installation
runs in parallel with your logging in, the installed packages may become
available a few moments after you reach the login prompt.
Cloud Shell uses
tmux by default, which allows it to improve
persistence across browser tab sessions. For example, if you refresh the
Cloud Console in a tab or connect to your Cloud Shell from a
different machine, the session state will not be lost.
Cloud Shell supports the default
tmux key bindings. For
example, if you press Ctrl+b and then %,
tmux splits the current
session window into left and right panes, which can be useful for debugging.
tmux in Cloud Shell, click the Terminal Settings button
(wrench icon), select Tmux Settings and de-select the
Enable Tmux Integration option.
Cloud Shell collects anonymized usage statistics on commands that are run inside the Cloud Shell terminal. Statistics are collected only on commands that come pre-installed in the Cloud Shell. Additionally, these metrics cannot be tied back to your account.
Metrics aren't collected on any personally identifiable information, such as arguments passed to these commands.
To change metrics collection preferences at any time, select Terminal Usage Statistics in the Settings menu . Any change in your preferences on the Settings menu takes effect on the next session. You'll have to close your tab and open another one once you've made your change to enable/disable metrics collection.
Note: This is separate from gcloud usage statistics, which is enabled by default in Cloud Shell.
To disable gcloud command-line tool metrics collection, run the following command in your Cloud Shell session:
gcloud config set disable_usage_reporting true