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:

user_name@cloudshell:~ (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:

pimballeke@cloudshell:~ (service-exploration-labs-20430)$ export PS1='[u@h W]/pre>  
[pimballeke@cs-6000-devshell-vm-b755b8e0-e267-4e9b-a224-2d6ecaca77dc ~]$

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?