How to bring terminal colors back to the way they were in Mint 18?
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
-
- Level 4
- Posts: 206
- Joined: Fri Jul 01, 2016 6:10 pm
How to bring terminal colors back to the way they were in Mint 18?
I've been trying out Mint 19, and one thing I noticed is that color themes (e.g. black on white) no longer color code the start of each new line. By "line", I just mean the $ symbol that signals the beginning of a new command. Because all of the text is one color, it's much harder for me to tell where one line ends and the next begins.
I would like to revert my terminal's appearance back to the way it was: one color for the background, one color for input and output text, and a third color to signal the start of each new line. Is this still possible in Mint 19 (Mate)?
Thanks!
I would like to revert my terminal's appearance back to the way it was: one color for the background, one color for input and output text, and a third color to signal the start of each new line. Is this still possible in Mint 19 (Mate)?
Thanks!
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Re: How to bring terminal colors back to the way they were in Mint 18?
The standard PS1 on 18.3 is
whereas on 19 it is
So as to get 18.3's coloured $ back you want to move the \$ to before the \[\033[00m\]. Adjust this in your ~/.bashrc:
Code: Select all
\[\e]0;\u@\h \w\a\]${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\] \[\033[01;34m\]\w \$\[\033[00m\]\
Code: Select all
\[\e]0;\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$\
Code: Select all
...
if [ "$color_prompt" = yes ]; then
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
...
-
- Level 4
- Posts: 206
- Joined: Fri Jul 01, 2016 6:10 pm
Re: How to bring terminal colors back to the way they were in Mint 18?
Thank you! I got my colors back. Is there a comprehensive resource on what the variables, color coding, and other formatting in .bashrc mean? I've only found bits and pieces. I now know the color is controlled by the PS1 variable. I also found a list of the color codes at https://linuxconfig.org/bash-prompt-bas ... characters
But the rest of the file remains a total mystery. I could use some help breaking it down. In particular, I don't know what
But the rest of the file remains a total mystery. I could use some help breaking it down. In particular, I don't know what
\03
means.Re: How to bring terminal colors back to the way they were in Mint 18?
First of all note that ~/.bashrc is a generic bash script; admittedly one with the specific purpose of configuring bash but a general script nonetheless. As such,
Now, colours are not a function of bash or its prompt itself, but of the terminal (-emulator) it is running in. A comprehensive list of escape codes for the terminal, i.e., commands for the terminal, is not light reading; you under Cinnamon use gnome-terminal, eventually based off of xterm; a list of xterm escape codes looks like https://invisible-island.net/xterm/ctlseqs/ctlseqs.html. Also see e.g. https://en.wikipedia.org/wiki/ANSI_escape_code.
Terminal escape codes are called such due to the manner you relay them to the terminal; you output an ASCII ESC control code, in bash generated with \e or \033, followed by the actual code/command. To for example take the colour escapes with which you are now already somewhat familiar as an example: try from a bash prompt
As the above PROMPTING section from the bash manpage says, you will in PS1 have to place terminal escapes within \[ and \].
At the start of the (eventual) PS1 of both 18.3 and 19 is another escape code, \e]0;\u@\h \w \a. The \u, \h, \w are still the bash escapes from that PROMPTING section, and \e]0;TITLE\a is a terminal escape that sets the window title. I.e., try
The "&& read" is there so that you have time to see the window title change before the next PS1 prompt sets the title back to "\u@\h \w " because that, then, is what that part does...
This leaves only the "${debian_chroot:+($debian_chroot)}" bit of PS1 undescribed; this is generic bash that says "if the environment variable $debian_chroot is null or unset, do nothing, otherwise replace me with the string "(" + $debian_chroot + ")".
As to that last paragraph the important part is that it's generic bash; that you just need to understand bash scripting to understand it. As to PS1 you need to know bash prompting, and as to terminal escapes, terminal emulators.
Hope that's useful...
man bash
is the most comprehensive resource. If you for example after man bash
type 1790g
you will (for the current Mint 19 version of the manpage) end up at the PROMPTING section that explains some of the same things your link does, specifically lists the escape codes that bash itself interprets as part of its PS1 prompt.Now, colours are not a function of bash or its prompt itself, but of the terminal (-emulator) it is running in. A comprehensive list of escape codes for the terminal, i.e., commands for the terminal, is not light reading; you under Cinnamon use gnome-terminal, eventually based off of xterm; a list of xterm escape codes looks like https://invisible-island.net/xterm/ctlseqs/ctlseqs.html. Also see e.g. https://en.wikipedia.org/wiki/ANSI_escape_code.
Terminal escape codes are called such due to the manner you relay them to the terminal; you output an ASCII ESC control code, in bash generated with \e or \033, followed by the actual code/command. To for example take the colour escapes with which you are now already somewhat familiar as an example: try from a bash prompt
Code: Select all
echo -e "\e[;31mR\e[;32mG\e[;34mB"
At the start of the (eventual) PS1 of both 18.3 and 19 is another escape code, \e]0;\u@\h \w \a. The \u, \h, \w are still the bash escapes from that PROMPTING section, and \e]0;TITLE\a is a terminal escape that sets the window title. I.e., try
Code: Select all
echo -e "\e]0;Look at the terminal window title\a" && read
This leaves only the "${debian_chroot:+($debian_chroot)}" bit of PS1 undescribed; this is generic bash that says "if the environment variable $debian_chroot is null or unset, do nothing, otherwise replace me with the string "(" + $debian_chroot + ")".
man bash
, 947g
, the ${parameter:+word} part. $debian_chroot is a bit earlier in ~/.bashrc set depending on whether or not you are in fact inside of a chroot.As to that last paragraph the important part is that it's generic bash; that you just need to understand bash scripting to understand it. As to PS1 you need to know bash prompting, and as to terminal escapes, terminal emulators.
Hope that's useful...
-
- Level 4
- Posts: 206
- Joined: Fri Jul 01, 2016 6:10 pm
Re: How to bring terminal colors back to the way they were in Mint 18?
Thank you rene! But does anything change if I'm using Mate instead of Cinnamon? The installation of Mint that you fixed was Mint 19 Mate 64-bit. I believe I saw slight differences between your lines and mine, so I copied and pasted the Mint 18.3 block to be safe, and it worked.
By the way, how do you know all of this? I have been using Mint for years, but I sometimes still feel like I just switched over from Windows.
By the way, how do you know all of this? I have been using Mint for years, but I sometimes still feel like I just switched over from Windows.
Re: How to bring terminal colors back to the way they were in Mint 18?
No, nothing changes wrt. this PS1 issue between Cinnamon and MATE. PS1 itself is as explained a bash setting/variable and bash lives at a level below any desktop environment.
The described terminal escape codes could theoretically differ between the two environments if they were to use significantly different terminal emulators but don't in practice, certainly not for the basic escape codes. Both Cinnamon and MATE use a version/fork of gnome-terminal, itself based off of xterm, and are to a large degree "the same", compatible. Xfce and KDE use terminal emulators that are a little farther removed from each other and gnome-terminal, but again not really from xterm. The standard X11 xterm terminal emulator basically dictates what it means to be an X11 terminal emulator; the rest follows suit.
As to knowing all this shite... I've been on Linux basically exclusively since 1999, non-exclusively a bit longer. Back then starting a GUI was something you'd do on the rare occasion you wanted to use a web-browser for something. That is, I have been "part of" the built-up of the software stack, from kernel all the way up to desktop environments, and have as such a fairly effective overview of what level/layer some specific issue resides at. In Linux that's generally steps 1, 2, 3 and 4 of understanding something or at least knowing how and where to find information.
What also helps is that said built-up has basically not changed over the last 20 years; Wayland will finally do something about that at the GUI level. What on the other hand does not help is that I've basically hated X11's guts from the get-go; always steered clear of "understanding" it to any level above the absolutely needed. Wayland might also do something about that. I hope...
The described terminal escape codes could theoretically differ between the two environments if they were to use significantly different terminal emulators but don't in practice, certainly not for the basic escape codes. Both Cinnamon and MATE use a version/fork of gnome-terminal, itself based off of xterm, and are to a large degree "the same", compatible. Xfce and KDE use terminal emulators that are a little farther removed from each other and gnome-terminal, but again not really from xterm. The standard X11 xterm terminal emulator basically dictates what it means to be an X11 terminal emulator; the rest follows suit.
As to knowing all this shite... I've been on Linux basically exclusively since 1999, non-exclusively a bit longer. Back then starting a GUI was something you'd do on the rare occasion you wanted to use a web-browser for something. That is, I have been "part of" the built-up of the software stack, from kernel all the way up to desktop environments, and have as such a fairly effective overview of what level/layer some specific issue resides at. In Linux that's generally steps 1, 2, 3 and 4 of understanding something or at least knowing how and where to find information.
What also helps is that said built-up has basically not changed over the last 20 years; Wayland will finally do something about that at the GUI level. What on the other hand does not help is that I've basically hated X11's guts from the get-go; always steered clear of "understanding" it to any level above the absolutely needed. Wayland might also do something about that. I hope...
-
- Level 4
- Posts: 206
- Joined: Fri Jul 01, 2016 6:10 pm
Re: How to bring terminal colors back to the way they were in Mint 18?
I wish I could be on Linux exclusively, but I can't. There is some stuff that will only run on Windows, or that might run on Wine, but breaks often enough for me to not have time to tinker with it manually, so I do a dual boot and run both instead.
If you don't mind my asking, do you have formal education (e.g. IT or computer science background) that helps you troubleshoot all these problems that you help people with on this forum, or does this all come from the experience you mentioned as a long-time user?
If you don't mind my asking, do you have formal education (e.g. IT or computer science background) that helps you troubleshoot all these problems that you help people with on this forum, or does this all come from the experience you mentioned as a long-time user?
Re: How to bring terminal colors back to the way they were in Mint 18?
I started with mint dual booting with win7. Now mint is my primary OS with win7 in a VM (virtualbox). Works for me. I also use crossover - not free but better support for more apps than wine.I wish I could be on Linux exclusively, but I can't. There is some stuff that will only run on Windows, or that might run on Wine, but breaks often enough for me to not have time to tinker with it manually, so I do a dual boot and run both instead.
Thinkcentre M720Q - LM21.3 cinnamon, 4 x T430 - LM21.3 cinnamon, Homebrew desktop i5-8400+GTX1080 Cinnamon 19.0
Re: How to bring terminal colors back to the way they were in Mint 18?
My formal training is as a mathematician which, mind you, has in fact less to do directly with computers than many people think. I would feel it safe to say either (pre-)occupation roots in an interest in formal systems, but in the context of specifically this forum simple yet fairly severe geekness would seem to most directly speak to motivation. Yes, I did in fact at one point repair my glasses with scotch tape.
Re: How to bring terminal colors back to the way they were in Mint 18?
Hello rene,rene wrote: ⤴Mon Dec 10, 2018 6:22 pm The standard PS1 on 18.3 is
whereas on 19 it isCode: Select all
\[\e]0;\u@\h \w\a\]${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\] \[\033[01;34m\]\w \$\[\033[00m\]\
So as to get 18.3's coloured $ back you want to move the \$ to before the \[\033[00m\]. Adjust this in your ~/.bashrc:Code: Select all
\[\e]0;\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$\
Code: Select all
... if [ "$color_prompt" = yes ]; then PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ' ...
if the original statement was
Code: Select all
\[\e]0;\u@\h \w\a\]${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\] \[\033[01;34m\]\w \$\[\033[00m\]\
Besides, I remember a few versions ago grep would offer its results in color coding, like the sought expression was printed in red. Now this no longer works! How to fix that? I wonder who had spoiled that and FOR WHAT REASON?!
Linux Mint Mate 21.2 64, fanless box with passive cooling
Re: How to bring terminal colors back to the way they were in Mint 18?
I don't, the "if" line was just providing a bit of context as to what to look for in ~/.bashrc; as in (to OP) "adjust PS1 there".
I expect "you" respectively "BY MISTAKE" since everything's colourful for me and I seem to have the default Mint 19.1 ~/.bashrc, as verified per comparing it with /etc/skel/.bashrc (i.e., the default ~/.bashrc a new user gets).Besides, I remember a few versions ago grep would offer its results in color coding, like the sought expression was printed in red. Now this no longer works! How to fix that? I wonder who had spoiled that and FOR WHAT REASON?!
You may be using a weird terminal or have set the TERM environment variable wrong. But it seems nothing generic.
Re: How to bring terminal colors back to the way they were in Mint 18?
I installed LM 19.1 Mate and I used a default Terminal. Out of the box, colors did not work either for a user nor for the root.rene wrote: ⤴Mon Jan 28, 2019 3:57 pm I expect "you" respectively "BY MISTAKE" since everything's colourful for me and I seem to have the default Mint 19.1 ~/.bashrc, as verified per comparing it with /etc/skel/.bashrc (i.e., the default ~/.bashrc a new user gets).
You may be using a weird terminal or have set the TERM environment variable wrong. But it seems nothing generic.
But I have fixed it ever since by editing .bashrc.
Thank you for the info!
Linux Mint Mate 21.2 64, fanless box with passive cooling
Re: How to bring terminal colors back to the way they were in Mint 18?
Is there any step by step info how to do it? This info here will help person with some knowledge about Linux system to apply it. Unfortunately I do not have that needed knowledge, so my terminal is still the same. Thanx.
Re: How to bring terminal colors back to the way they were in Mint 18?
Another flaw in LM 19.1.
- smurphos
- Level 18
- Posts: 8498
- Joined: Fri Sep 05, 2014 12:18 am
- Location: Irish Brit in Portugal
- Contact:
Re: How to bring terminal colors back to the way they were in Mint 18?
Yawn....it's a design decision by the developers of bash and/or the maintainers of ubuntu bash. Nowt to to do with Mint.
Open ~/.bashrc in a text editor e.g
xed ~/.bashrc
and apply rene's edit as per his post above - viewtopic.php?p=1563947#p1563947
and save.
https://help.ubuntu.com/community/CustomizingBashPrompt
For custom Nemo actions, useful scripts for the Cinnamon desktop, and Cinnamox themes visit my Github pages.
Re: How to bring terminal colors back to the way they were in Mint 18?
smurphos, thank you very much for your solution. It is working beautifully. VICTORY!