to customize Google cloud shell, modify on of the following files:
- $HOME/.customize_environment
- $HOME/.profile
- $HOME/.bashrc
notes
- .customize_environment runs once when google shell instance boots up,
- .profile, .bashrc run once for each shell login, i.e: when a new shell opened they will run, use to customise the shell prompt or to add environments.
- if .bash_profile exists .profile, .bashrc will not executed
- when .customize_environment runs, not all parts (like npm) are available yet or not installed yet.
- it outputs it's log to /var/log/customize_environment, and touches /google/devshell/customize_environment_done
- welcome message is located in /etc/profile.d/init_help.sh
- to customise the prompt modify
PS1
(in $HOME/.bashrc or $HOME/.profile for example), override the value in /google/devshell/bashrc.google - any file outside of $HOME will be reset every on restart https://stackoverflow.com/a/67155805/12577650
- start .customize_environment with
#!/bin/sh
more details:
content of: /etc/profile.d/init_help.sh
note:
this file is outside of $HOME dir, so it will be reset every restart
todo: use another file inside of $HOME