1

I just installed centos7.2 and am trying to set it up somewhat nicely.

I found an answer on here that shows how to set up some colours in the prompt. I am finding that, once dropped into the .bashrc, it works fine when using putty to ssh in and when I use the Konsole app. But, when I use Terminal (which is gnome terminal), the colours will not match Michael's output (which is what I see in putty) and there is a funny character preceeding each piece of the output (which I tracked down to the \] sequence, which is supposed to be valid and doesn't choke elsewhere).

Is it known that gnome terminal behaves differently than other terminal programs? Any way to make it conform?

Not really liking konsole so much, but am open to suggestions for alternatives or ways to fix that will work across all clients (ie: I don't want to maintain two colour defs, for example, \e[01;32m prints the next chars green in putty and grey in gnome terminal; I have to use 38m in gnome terminal to get green).

  • It would greatly help if you could please post some concrete bits, like your prompt definitions, or screenshots about the faulty colors and those "funny" characters, as well as a screenshot in konsole or putty which looks like you expect it. – egmont Nov 16 '16 at 23:05
0

No, gnome-terminal is not meant to behave differently than the others, although the exact shade of the 16 base colors is somewhat different across all the terminal emulators. (Update based on JdeBP's comment below: in some palettes, e.g. Solarized, these colors are deliberately totally different.)

You should look around in gnome-terminal's Edit -> Profile Preferences -> Colors dialog and choose a scheme that matches your taste.

In the escape sequence \e[01;32m 01 stands for bright and/or bold (there's a confusion about it across terminal emulators) and 32 stands for green foreground. 38 on the other hand means the terminal emulator's default foreground, which is green if you happen to have the "green on black" color scheme by default, but more typically it's either white or black.

Assuming your shell is bash, its PS1 prompt is required to enclose all the escape sequences between \[ and \], this is how bash knows that printing those won't advance the cursor, and hence editing the command line won't fall apart. Assuming that these are indeed present in pairs in PS1, bash consumes them and never prints them to the terminal, so there's no way gnome-terminal could do anything nasty there. Probably they are not properly balanced in your PS1.

  • 2
    You might want to mention gnome-terminal's "palette" configuration. If it is set to "Solarized" then bold green does indeed come out as grey. – JdeBP Nov 17 '16 at 21:12
  • The comment regarding the colour scheme affecting the output was bang on. I thought the colour was going to come out "green" but, I did not realize that changing the pallete affected what "green" actually is. As far as the \[ \] .. this is only a problem on gnome terminal. Putty and Konsole do not show this... perhaps that is their failing. If you refer to the answer I posted in the OP, you can see that there are \] happening before any \[. I removed those (\]) and all appears fine. – Jon Nov 21 '16 at 16:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.