Get a Colour Command Prompt in your Terminal Windows

Whenever you open a terminal window a script file called .bashrc is run. This establishes certain settings within your terminal environment.
In your home folder, if you type:

cat .bashrc

You will see the contents of this file listed to the screen.

To stop the output whizzing past in a flash type the following:

cat .bashrc | less

This will allow the less program to handle the output. You can then scroll backwards and forwards through the contents of the file using the Home, End and Up Arrow and Down Arrow keys. Q will exit back to the prompt. This is a convenient way to examine text files safely – there is no danger of you accidently making changes to them.

Within the .bashrc file are some lines that look like this:

# uncomment for a colored prompt, if the terminal has the capability; turned
# off by default to not distract the user: the focus in a terminal window
# should be on the output of commands, not on the prompt
#force_color_prompt=yes

if you want to have a colour prompt in your terminal windows, in your home folder type:

gedit .bashrc

This causes the gedit editor top open the file so you can make changes to it. Be Careful! Change the line that said:

#force_color_prompt=yes

to now say:

force_color_prompt=yes

Save the file, and close gedit. Close the terminal window and open a new terminal window. I use keyboard shortcuts a lot, so I do this through:

Ctrl+Alt+T

You should now see a colour prompt.

It’s not life-changing perhaps, but it helps to visually distinguish the output from the shell prompt.

Tags : , ,

0 thoughts on “Get a Colour Command Prompt in your Terminal Windows”

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.