linux changes directory to display color instance detail

  • 2020-06-03 09:02:07
  • OfStack

linux changes directory display color instance detail

When listing directories in shell, the folders are all blue and the background is black, making it hard to see the blue file names. I have encountered this problem for several times and failed to record the solution, so I have to look up some information every time. This time, I decided to sort out this method so that I can use it in the future after encountering the same situation.

Solutions for files

To configure the current user, add the following parameters in the./bashrc directory of the current user home.

Here I simply changed the format of the folder to bold, the foreground color to yellow, the background color to black. There are also quotes in bold, cyan foreground, and black background.
Here, focus on 1 di related parameters.

export LS_COLORS

See other articles that address the problem in the following ways

1. Copy /etc/DIR_COLORS file to.dir_colors of current home directory

 cp /etc/DIR_COLORS ~/.dir_colors

2. Modify the color corresponding to DIR in ~/.dir_colors

 vim ~/.dir_colors

  The first 59 Line: DIR 01;34 ( 01 : bold, 34 : blue) 

  Is amended as: DIR 01;33 ( 01 : bold, 33 Yellow:) 

Intellectual development

The file type

Referred to as"

no    NORMAL, NORM  Global default 
fi    FILE  Common file 
di     DIR  directory 
ln    SYMLINK, LINK, LNK  link 
pi    FIFO, PIPE  The pipe 
do    DOOR Door
bd    BLOCK, BLK  Piece of equipment 
cd    CHAR, CHR  Character device 
or    ORPHAN  The target does not exist to a symbolic link 
so    SOCK  The socket Socket
su    SETUID  owner setuid Valid file 
sg    SETGID  Belong to the group setuid Valid to file 
tw    STICKY_OTHER_WRITABLE Directory that is sticky and other-writable ( t,o w)
ow    OTHER_WRITABLE Directory that is other-writable (o w) and not sticky
st    STICKY Directory with the sticky bit set ( t) and not other-writable
ex    EXEC Executable file (i.e. has  ' x' set in permissions)
mi    MISSING Non-existent file pointed to by a symbolic link (visible when you type ls -l)
lc     LEFTCODE, LEFT Opening terminal code
rc     RIGHTCODE, RIGHT Closing terminal code
ec    ENDCODE, END Non-filename text  

Use the form of an extension

*.extension Every file using this extension e.g. *.jpg

Code and color values

Code colors/actions

0  Reset the properties to the default Settings 
1  Set in bold 
2  Set up the 1 Semi-luminance (color of analog color display) 
4  Set the underline (to simulate the color of the color display) 
5  Set the flash 
7  Set the reverse image 
22  Set up the 1 As the density 
24  Close underline 
25  Closed flashing  27  Close the reverse image 
30  Set the black foreground 
31  Set the red foreground 
32  Set the green foreground 
33  Set the brown foreground 
34  Set the blue foreground 
35  Set the purple foreground 
36  Set the cyan foreground 
37  Set the white foreground 
38  Set the underscore on the default foreground color 
39  Turn off the underline on the default foreground color 
40  Set a black background 
41  Set a red background 
42  Set a green background 
43  Set a brown background 
44  Set a blue background 
45  Set a purple background  46  Set the cyan background 
47  Set a white background 
49  Set the default black background 

Thank you for reading, I hope to help you, thank you for your support to this site!

Related articles: