Google Certified Associate Cloud Engineer 2020

Sign Up Free or Log In to participate!

How to change prompt to hide user and project in Google Cloud Shell

In Google Cloud Shell  I have:

[email protected]:~ (project-name-12345)$

it takes up too much space, how to make it only

$

?

Thanks

Mícheál Ó Laoghaire

Looks for the PS1 variable, in my environment the .bashrc file sources the fille /google/devshell/bashrc.google, in there is the PS1 environmental variable. You can cat this file and them customise the PS1 variable but adding it to the end of your ~/.bashrc file. This worked in my environment to remove the user component.

Mícheál Ó Laoghaire

add this to the end of your ~/.bashrc file to give you the dollar $ prompt, you can always comment it out and source your ~/.bashrc file again if it cause you problems: export PS1=’$ ‘

1 Answers

Hey Rafal,

Play with that exporting the PS1, like below:

[email protected]:~ (service-exploration-labs-20430)$ export PS1='[[email protected] W]/pre>  
[pimball[email protected] ~]$

Also, you can follow this to have yet more fun:

https://www.cyberciti.biz/tips/howto-linux-unix-bash-shell-setup-prompt.html

-Bianchi

Sign In
Welcome Back!

Psst…this one if you’ve been moved to ACG!

Get Started
Who’s going to be learning?