Reputation: 95
I'm trying to change the foreground color of the terminal when I log in into a server with an ssh client.
With putty I can achieve this very simply, setting the foreground color in the color section of the client, but I'd like to set this at server side, e.g. in the bashrc or the bash_profile files.
I've tried tput and setterm and they works fine, but after a ls command the color is resetted.
tput setaf 1
setterm -term linux -back red -fore white -clear rest
Any solution? Thanks everybody
Upvotes: 1
Views: 1563
Reputation: 95
One workaround I've find is to add the following lines in the bottom of the ~/.bash_profile :
export PROMPT_COMMAND="$PROMPT_COMMAND;tput setaf 1"
This will execute the command to set the color (tput setaf 1) after every terminal command (and before the next prompt)
Reference: http://www.tldp.org/HOWTO/Bash-Prompt-HOWTO/x264.html
Upvotes: 0
Reputation: 80961
You can't do this at the server level. You can set the current foreground color (what those commands are doing) at the shell/etc. level but when the shell/other programs tell the terminal to reset it will fall back to its default color which is going to be 0
.
To change what color is displayed when programs ask for color 0
you need to change that at the terminal level (like the putty settings).
Upvotes: 1