1

I want to change the colours in my Terminal and a cursory Google search shows me to right click in terminal and go to properties, etc.

So I managed to change my background, and the text, but I was wondering if I can have what I type be one colour and the system prompts be a different colour?

Ubuntu 14.04. Running it as a VM on a host Windows 7.

1 Answer 1

3

For changing the background (and text) colours, you simply go to profile preferences and set it there:

For the prompt itself, this is set in the prompt itself, this is more complex. This is set from the ~/.bashrc hidden file (or another similar file), probably using a line like this (it will begin with PS1):

PS1='${debian_chroot:+($debian_chroot)}\[\033[01;34m\]\u@\h\[\033[00m\]:\[\033[01;32m\]\w\[\033[00m\]\$ '

The colour in the prompt is set using escape codes (if the terminal being used supports it)- so basically each bit of \033[Nm sets the format for the following text, depending on what N (N can be multiple things separated by ; BTW).

For the basic colours, you can use the simple numeric codes listed here: enter image description here
1 Makes stuff bold, 0 resets - multiple things can be used as well - e.g:

echo -e "\033[1;32mExample\033[0m"

Otherwise you can set your own colour (probably limited support):

echo -e "\033[38;2;240;115;0mOrange\033[0m"

So you can fairly easily edit the PS1 line to suit (and test it with echo -e ...). I recently did this with various colours for different machines so I could use multiple terminals without typing the right command into the wrong computer...

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .