Find the answer to your Linux question:
Results 1 to 3 of 3
I can create my own color scheme (to ls) by copying /etc/DIR_COLORS to ~/.dir_colors and changing the values locally. It appears from playing around with it, that EXEC takes precedence ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Jul 2012
    Posts
    5

    ls DIR_COLORS


    I can create my own color scheme (to ls) by copying /etc/DIR_COLORS to ~/.dir_colors and changing the values locally. It appears from playing around with it, that EXEC takes precedence over individual file extension colors. So, if I set up a color for .foo of 00;33 and EXEC is set to 00;31 and the file permissions is 777, then it will be color 31 rather than 33. Additionally, if I set EXEC to 00;00 OR comment out EXEC altogether (in ~/.dir_colors) it defaults to the EXEC colors in/etc/DIR_COLORS, rather than ~/.dir_colors. At least that's how it appears to work.

    Is there a way to turn off the behavior so that file permissions do not play a part in the "decision" of which color the files appear? I don't really care about the file permissions so much as I care about the file extensions. I'd rather all .foo files be the same color, rather than the extension being two different colors because one is 766 and one's 777.

    I won't be able to change /etc/DIR_COLORS because that would change it for all users and that would certainly be frowned upon.

  2. #2
    Linux Enthusiast
    Join Date
    Jan 2005
    Location
    Saint Paul, MN
    Posts
    645
    Quote Originally Posted by linuxcoder View Post
    I can create my own color scheme (to ls) by copying /etc/DIR_COLORS to ~/.dir_colors and changing the values locally. It appears from playing around with it, that EXEC takes precedence over individual file extension colors. So, if I set up a color for .foo of 00;33 and EXEC is set to 00;31 and the file permissions is 777, then it will be color 31 rather than 33. Additionally, if I set EXEC to 00;00 OR comment out EXEC altogether (in ~/.dir_colors) it defaults to the EXEC colors in/etc/DIR_COLORS, rather than ~/.dir_colors. At least that's how it appears to work.

    Is there a way to turn off the behavior so that file permissions do not play a part in the "decision" of which color the files appear? I don't really care about the file permissions so much as I care about the file extensions. I'd rather all .foo files be the same color, rather than the extension being two different colors because one is 766 and one's 777.

    I won't be able to change /etc/DIR_COLORS because that would change it for all users and that would certainly be frowned upon.
    You need to look at the command "dircolors" which outputs code that cab be added into your startup location (such as ~/.bash_profile). A simple "man ls" would have told you about dircolors.

  3. #3
    Just Joined!
    Join Date
    Jul 2012
    Posts
    5
    Quote Originally Posted by alf55 View Post
    You need to look at the command "dircolors" which outputs code that cab be added into your startup location (such as ~/.bash_profile). A simple "man ls" would have told you about dircolors.
    I did look into that and spent a considerable amount of time researching and trying different methods long before taking the time to post the question. In no instance was I able to get the EXEC colors to be ignored.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •