How to set terminal text color to be context sensitive - [Solved]

All Gurus once were Newbies
Forum rules
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Please stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions prefer the other forums within the support section.
Before you post please read how to get help
Post Reply
micksulley
Level 3
Level 3
Posts: 124
Joined: Fri Feb 14, 2014 11:32 am

How to set terminal text color to be context sensitive - [Solved]

Post by micksulley » Sun Feb 12, 2017 8:45 am

Not sure I have worded the title very well, here it what I mean
When I ssh into on of my Raspberry Pi's I see the 'user@machine' in green, if I list files I see text files in white, directories in blue, executables in green.
In a terminal on my Mint desktop everything is white on black.
I have tried changing preferences and profiles but cannot see how to achieve the same as on the Pi, I have also looked at the preferences in the Pi and cannot see any differences.

I am pretty sure it should be easy to do, can anyone tell me please?

Running Mint 18 Cinnamon

Thanks
Mick
Last edited by micksulley on Sun Feb 12, 2017 10:19 am, edited 1 time in total.

User avatar
richyrich
Level 19
Level 19
Posts: 9075
Joined: Mon May 04, 2009 8:31 pm

Re: How to set terminal text color to be context sensitive

Post by richyrich » Sun Feb 12, 2017 9:19 am

I'm not sure about the terminal in Cinnamon, but in the Xfce Terminal I can achieve this by changing the "Palette" colours in Preferences.

George99
Level 3
Level 3
Posts: 106
Joined: Sun Aug 10, 2014 10:59 am

Re: How to set terminal text color to be context sensitive

Post by George99 » Sun Feb 12, 2017 9:27 am

Well I do see a color ouput in a terminal with Mint Cinn. 18 but maybe you edited your local .bashrc configuration file.
Type in a terminal "type ls" and see if it tells you something like "ls ist ein Alias von `ls --color=auto'." in your own language.
The green prompt is also defined in your local .bashrc file.

micksulley
Level 3
Level 3
Posts: 124
Joined: Fri Feb 14, 2014 11:32 am

Re: How to set terminal text color to be context sensitive

Post by micksulley » Sun Feb 12, 2017 9:35 am

I can go into Edit > Profile Preferences and on the Colours tab I can change text and background colours, but it is a blanket change, file type makes no difference

I don't seem to have a .bashrc configuration file.
type ls returns

Code: Select all

mick@MickMintDesk ~ $ type ls
ls is /bin/ls
mick@MickMintDesk ~ $ 
Last edited by micksulley on Sun Feb 12, 2017 9:42 am, edited 1 time in total.

User avatar
austin.texas
Level 20
Level 20
Posts: 12054
Joined: Tue Nov 17, 2009 3:57 pm
Location: at /home

Re: How to set terminal text color to be context sensitive

Post by austin.texas » Sun Feb 12, 2017 9:39 am

In Cinnamon, in the terminal, first click on the Edit menu > Preferences > Profiles tab > New
Give your new Profile a name, then at the bottom set it to use that Profile by default when opening a new terminal.
Then switch to that Profile (close the terminal and open a new one).
Right-click anywhere in the terminal > Profiles > Profile Preferences > Colors
Uncheck "Use System Colors", then set your own colors, using the palette.

I have notes for the colors I am using:

Rainy Day Blues Dark terminal profile:
Size: 144 X 66
Text color #4FF3F7
Bold color #8BE7F7
Background color #0E5B80
Palette entry 5 #3465A4
Palette entry 7 #06989A
Palette entry 8 #38B3E3
Palette entry 15 #34E2E2

Minty Green terminal profile:
Size: 120 X 55
Text color #186B18
Bold color #59E746
Background color #C7FCC9
Palette entry 3 #00AA00
Palette entry 8 #13BC41
Palette entry 13 #1C1C58

Autumn Woods terminal profile:
Size: 144 X 66
Text color: white
Bold color: #F97C3A
Background color: #c09c5e
Palette entry 8: #981919
Palette entry 13: #F9DC78

Now, that takes care of the colors... EXCEPT that you cannot change the prompt color in the Profile settings. To change the prompt color, open .bashrc in your text editor.

Code: Select all

xed ~/.bashrc
Add these lines to the existing text (if there is existing text - if not, that's fine, too... Since you said it does not exist, this will create it for you.)

Code: Select all

# All golden brown prompt - 00;33
#PS1='${debian_chroot:+($debian_chroot)}\[\033[00;33m\]\u\[\033[00;33m\]@\[\033[00;33m\]\h \[\033[00;33m\]\w \[\033[00;33m\]\$\[\033[00m\] '
#All green prompt:
#PS1='${debian_chroot:+($debian_chroot)}\[\033[00;32m\]\u\[\033[00;32m\]@\[\033[00;32m\]\h \[\033[00;32m\]\w \[\033[00;32m\]\$\[\033[00m\] '
#all red prompt
#PS1='${debian_chroot:+($debian_chroot)}\[\033[00;31m\]\u\[\033[00;31m\]@\[\033[00;31m\]\h \[\033[00;31m\]\w \[\033[00;31m\]\$\[\033[00m\] '
#all white prompt
#PS1='${debian_chroot:+($debian_chroot)}\[\033[01;37m\]\u\[\033[01;37m\]@\[\033[01;37m\]\h \[\033[01;37m\]\w \[\033[01;37m\]\$\[\033[00m\] '
Then remove the # from the PS1 line you want to use - gold, green, red, or white.

Guide to prompt codes:
https://ubuntugenius.wordpress.com/2011 ... -terminal/

Bash colour chart:
http://www.arwin.net/tech/bash.php

Autumn Woods profile:
terminal.jpg
Last edited by austin.texas on Sun Feb 12, 2017 10:14 am, edited 4 times in total.
Mint 18.2 Cinnamon, Quad core AMD A8-3870 with Radeon HD Graphics 6550D, 8GB DDR3, Ralink RT2561/RT61 802.11g PCI
Linux Linx 2018

George99
Level 3
Level 3
Posts: 106
Joined: Sun Aug 10, 2014 10:59 am

Re: How to set terminal text color to be context sensitive

Post by George99 » Sun Feb 12, 2017 9:49 am

micksulley wrote:I
type ls returns

Code: Select all

mick@MickMintDesk ~ $ type ls
ls is /bin/ls
mick@MickMintDesk ~ $ 
OK, so you either deleted or edited .bashrc. You will find a copy of an unchanged version of .bashrc in /etc/skel/.bashrc.

So try this:

Code: Select all

mv ~/.bashrc ~/.bashrc_old
cp /etc/skel/.bashrc ~
and open a new terminal to check the result.

You can go back to your old version by

Code: Select all

rm ~/.bashrc
mv ~/.bashrc_old ~/.bashrc

micksulley
Level 3
Level 3
Posts: 124
Joined: Fri Feb 14, 2014 11:32 am

Re: How to set terminal text color to be context sensitive - Fixed

Post by micksulley » Sun Feb 12, 2017 10:18 am

Yes! restoring the .bashrc that I didn't know I had deleted has fixed it, it is now context sensitive on listings.

I also have info on how to play around with the colours

Many thanks
Mick

Post Reply

Return to “Newbie Questions”