Even if you define .dir_color, the directory and file colors will be the same color.

Asked 1 years ago, Updated 1 years ago, 68 views

All the directories and files will be displayed in white on the server you are logged in to.
I first copied /etc/DIR_COLORS to my home directory as .dir_colors.

Some of the contents of ~/.dir_colors are as follows.

#Below are the color init strings for the basic file types.A color init
# US>string registers of one or more of the following numeric codes:
# Attribute codes:
# 00=none01=bold04=undercore05=blink07=reverse08=concealed
# Text color codes:
# 30=black31=red32=green33=yellow34=blue35=magenta36=cyan37=white
# Background color codes:
# 40=black41=red42=green43=yellow44=blue45=magenta46=cyan47=white
NORMAL00#global default, through everything should be something.
FILE00#normal file
DIR01;34# directory
LINK 01;36#symbolic link
FIFO 40;33#pipe
SOCK01;35#socket
BLK 40;33;01 #block device driver
CHR40;33;01#character device driver
ORPHAN 01;05;37;41#orphaned syminks
MISSING 01;05;37;41#...and the files they point to

# This is for files with execute permission:
EXEC 01;32

I added eval`dircolors.dir_colors-b` to ~/.bashrc and ran source.bashrc, but both files and directories remained white.

echo$LS_COLORS also shows nothing.
What is the cause?

linux unix cygwin

2022-09-29 22:44

2 Answers

The variable echo$TERM was not listed in DIR_COLORS. I added TERM to the copied .dir_colors and it was resolved successfully.

By the way, it was also resolved by alias ls='ls --color'.

--Questioner's Comments.The idea is metropolis's Origin from this comment.


2022-09-29 22:44

eval`dircolors.dir_colors-b`

instead of

eval`dircolors~/.dir_colors-b`

I think it is necessary to(~/ is missing)


2022-09-29 22:44

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.