Friday, March 5, 2021

Customize and brighten the fonts in the bash prompt in Ubuntu on Windows

I run Ubuntu on Windows.  The prompt is too dark for me to see.  Here is how to brighten the prompt.

Edit ~/.bashrc

Append the following line:

 

PS1='\e[37;1m\u@\h \e[35m\w/ \e[0m\$ '

 

\u = Username

\h = Hostname

\w = Working directory

 

So \u@\h: makes the prompt
 

<username>@<hostname>:

 \e[ = Start a color scheme

The part that follows is a color:  37;1m

The 37 is the color.

The 1 says to use a bright version.

m somehow designates the end of the color sequence (but I'm not exactly sure of that part).


I made some more changes to make my life easier.  I added some spaces to the prompt before and after the working directory so I could double-click the working directory path and get the path easily into my copy buffer.