color coding of linux files

Four days back, i had wrote an article called linux file types. That time, I will be planning to write another article called, color coding of linux files. Now i’m going to do it. Its very very small geek but everybody want to know the color coding of linux file because this will help you on interview session.

When you use ls command on shell you can see the list of files and its color, on that directory. From my observation,I had found 7 colors of coding files. The color coding configuration file is located at /etc/DIR_COLORS. If you understand the configuration of color coding file you can change the color but default is recommended one.

I have tested this color coding on my CentOS (6.5) Server. See below.

1) Color coding of linux files ?

See the list of color coding files available.

  1. Bright Green – Executable Files
  2. Bright Red – Archives or Compressed Files (.tar,.tgz,.zip,.bz2,.tbz,.tbz2)
  3. Magenta – Image Formats(.jpg,.gif,.bmp,.png,.tif,.png), Socket Files
  4. Blue – Directory Files
  5. White – Regular Files
  6. Cyan – Symbolic Links, Audio Formats
  7. Yellow – Character Device Files, Block Device Files, Pipe Files

2) Example of Color coding files ?

I have collected all the files from our server and past the output below.

[email protected] [/home/mageshm]# ls -la
-rw-r--r--.  1 mageshm mageshm       124 May 11  2012 demo.txt
drwxr-xr-x.  3 mageshm mageshm      4096 Dec 31 14:24 links/
lrwxrwxrwx.  1 mageshm mageshm        31 Dec  7 15:11 s-link-file -> /links/soft-link/test-soft-link 
-rw-r--r--   1 mageshm mageshm      184K Jul 10  2013 9999_original.jpg
srw-rw-rw-.  1 root root               0 Jan 28 14:05 log=
crw-------.  1 root root          5,   1 Jan 28 14:05 console
brw-rw----.  1 root disk          7,   0 Jan 28 14:05 loop0
prw-------.  1 root root               0 Jan 28 14:06 replication-notify-fifo|
-rw-r--r--   1 root root            1.7M Aug 29  2011 sqlite-amalgamation-3.6.13.tar.gz
-rwxr-xr-x   1 root root             111 Jan 28 06:36*

Note :

For more details about color coding, check the man page and also check the /etc/DIR_COLORS file.

Magesh Maruthamuthu

Love to play with all Linux distribution

You may also like...