I've set two functions in my bashrc file to make this process easier. I've called the functions eep for expand prompt and ccp for contract prompt but you can call them whatever you'd like.
Open your bashrc file to edit:
vim ~/.bashrc
Add the following at the end:
INITIAL_PROMPT_COMMAND=$PROMPT_COMMAND
function ccp() {
PROMPT_COMMAND="PS1='# '"
}
function eep() {
PROMPT_COMMAND=$INITIAL_PROMPT_COMMAND
}
The first line simply sets the initial command prompt to a new variable so that we can access it later.
INITIAL_PROMPT_COMMAND=$PROMPT_COMMAND
The next two lines are functions eep and ccp that you can use to expand and contract your bash prompt.
After saving this file, you'll need to source it for it to take effect.
source ~/.bashrc