2

I would like to make my terminal more readable by having commands alternate the default text color. Ideally, this would only affect uncolored text. I'm rather new to linux, so any hints to point me in the right direction even would be appreciated.

The desired behavior would look something like this: enter image description here

Where the the red error notice remains red and all of what would have been white is changed to pink or blue.

Thanks for any help.

EDIT 1:

The pink and blue are just placeholders, so any two colors would be fine in their places.

Also, I'm using a bash shell.

Also Also, I will be ssh'ing regularly onto a server over which I don't have authority regularly, so it would be nice if the changes worked there too.

3

The VT100 terminal codes support setting the current color, and a "reset to default" which resets the color (and other attributes) to whatever the terminal considers the defaults. VT100 is the normal "baseline standard" that most commands support, though some might be programmed to be aware of more advanced terminal capabilities.

I am not aware of any way to change the color that the terminal considers the default, from within the terminal. This might be possible using i.e. some gnome command line tool to reach into the gnome settings system and change it for gnome terminal, but that might affect your entire window and not just the next to-be-written lines, and it would be very specific to one desktop arrangement.

You can easily change the current color inbetween commands, though. Your shell (like bash - see "PROMPT_COMMAND" ) usually has a way to run arbitrarily complicated code when rendering the prompt. But, if the command you run starts to alter the color of the terminal, there's probably no way to change it back to what you wanted until the end of the command. So that red "Error:" text in your example will change the rest of the color of the output until the next prompt. There might be some way to filter the output of all programs you run, but that would be asking for trouble down the road.

Also, those custom pink/blue aren't standard colors, so you'd have to research how to do that with the terminal you are using. (maybe update the question with that?) Otherwise here are the standard VT100 colors

  • Fiddling with let's say gnome-terminal's settings would be even worse: it would immediately effect all other gnome-terminal windows as well. There is a way to set the terminal's belief of default color, namely the OSC 10 and 11 escape sequences. They still work retroactively in the terminal, though, so not what OP is looking for. – egmont Jun 16 '18 at 22:39
  • @egmont I'm using bash on an Ubuntu machine. The OSC 10/11 thing sounds very similar to what I'm looking for, but why wouldn't they work? Also, What do you mean by "work retroactively in the terminal"? – Austin Weaver Jun 16 '18 at 22:44
  • @AustinWeaver Give it a try: echo -ne '\e]10;#abcdef\a'. If supported at all, it recolors all existing text as well, so it's not what you're looking for. What you're exactly looking for doesn't exist, hence I recommend other approaches such as a prompt that stands out pretty well (maybe powerline as suggested in another answer). – egmont Jun 17 '18 at 10:10
1

Powerline

is a good alternative if you like a more freaky command line. I like it, because you have an extremley good first sight where you input your command.

For installlation look at How to Install Powerline.

enter image description here

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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