We could be faced with very long bash prompt on ubuntu as the following example.
Then, we need to shorten the bash prompt. Let’s figure out how to do it.
For immediate effect but just once
On terminal, just type the following command and enter. It works promptly.
The long bash prompt above becomes as below.
or you can apply the following command.
It makes the long line as below
You may need to figure out where you are using the
pwd bash command.
For permanent effect
You can add the following option in your .bash_profile or .bashrc file.
Then, relaunch the terminal.
You can refer to here for further detailed information.