General
cancel
Showing results for 
Search instead for 
Did you mean: 

How to disable color change when going to other directories?

zhaogui
Super Advisor

How to disable color change when going to other directories?

I found out that every time when I 'cd' to /bin or /etc, the text color changes and it becomes blur against background color, how can I disable this feature/bug?

Thanks in advance,
5 REPLIES
Eugen Cocalea
Respected Contributor

Re: How to disable color change when going to other directories?

Hi,

Just 'cd'-ing to the directory changes the colors or after you do a 'ls' on it? Anyway, try setting your terminal to another thing, like 'linux', 'ansi' or 'vt100' and see the differences.

E.
To Live Is To Learn
zhaogui
Super Advisor

Re: How to disable color change when going to other directories?

My TERM is vt100. I found /etc/DIR_COLORS, how to modify this file for remote telnet session?
Mark Fenton
Esteemed Contributor

Re: How to disable color change when going to other directories?

I think you hit the nail on the head when you pin pointed the DIR_COLOR file. Let's take this a step or two further -- this file is called from the definitions in /etc/profile.d (RedHat Linux 7.x) wherein there are "colorizing" wrappers for all kinds of shells. The files in /etc/profile.d are in turn called by /etc/bashrc, which in, turn is called by your /homedir/.bashrc, which is called by your /homedir/.profile. -- convoluted, no?

If the issue you have is merely with the vt100 profile, I'd recommend that you just change the entry in /etc/DIR_COLORS for vt100 terminals so that the results will be more to your liking.

If, on the other hand, you just don't want the colorizing in your profile, no matter which terminal type you're using, then change your .bashrc to not call /etc/bashrc, and skip the whole mess.

Best of tweaking....
zhaogui
Super Advisor

Re: How to disable color change when going to other directories?

I found /etc/profile also calls /etc/profile.d/*.sh. But I don't know how to modify that file as shown in the attachment. Even I run 'export TERM=ansi', it still doesn't make any difference in terms of text color in my telnet session. Any idea how to make some changes with this file?
Marco Paganini
Respected Contributor

Re: How to disable color change when going to other directories?

You're probably telnetting to a Linux box from a broken terminal, that doesn't know how to handle ANSI color sequences properly. I had this a lot in the past when telnetting to Linux from SCO boxes.

The simplest way to check the theory is to do:

unalias ls

And try a ls -l on any directory.

The "ls" command is normally aliased to "ls --color==tty", giving your the color output. If after the 'unalias' command your problem is solved, it's just a matter of editing a few config files (under /etc/profile.d, if I remember correctly) to make it permanent.

Paga
Keeping alive, until I die.