When I ssh into a remote server, I like the colors of the terminal to change. I use setterm on my remote ~/.bashrc file to get this done. However, when I exit, the terminal colors are not reset to the local ones.

I solved the problem, but I am not sure if it is the best solution. This is what I could come up with.

On the ~/.bash_logout on the remote server, I put:

echo -e "\033[0m"
/usr/bin/clear

Just out of curiousity: Does anyone know of a better way? (I got the echo -e "\033[0m" line from http://edoceo.com/liber/linux-bash-shell)

link|improve this question

50% accept rate
I recommend you use tput to change colours instead. Look it up. – Ram Jul 31 '11 at 16:14
feedback

1 Answer

If you put the colors you want in the remote account's ~/.bashrc it should take effect on login and revert to your local settings on exit.

link|improve this answer
I thought so too. But, they did not revert back when I exited ssh. Maybe it's because I was using setterm in .bashrc (using GNOME terminal). Do you use a different method of setting the color scheme in .bashrc? – dgo.a Jul 31 '11 at 18:24
if you're using GNOME, I'm assuming you run linux. I use Ubuntu, but I'm guessing the process is pretty similar across the distros. You can backup the file then open it in a text editor and edit the contents starting at the line that says PS1=. You can find information at novell.com/coolsolutions/tools/17142.html. It tells you more than you ever wanted to know about the .bashrc file. – Yitzchak Jul 31 '11 at 19:16
feedback

Your Answer

 
or
required, but never shown

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