Ubuntu – What do the different colors mean in ls

colorscommand linels

What do the different colours in Ubuntu's ls command mean? For example, when I type the ls command in one of my folders, I get one of the files in light green, the other (which is a folder) in blue with green highlighting.

What do those colours mean, and there is any manual about all the colours?

Best Answer

  • Blue: Directory
  • Green: Executable or recognized data file
  • Cyan (Sky Blue): Symbolic link file
  • Yellow with black background: Device
  • Magenta (Pink): Graphic image file
  • Red: Archive file
  • Red with black background: Broken link

For your information:

  • To turn the color off, you have to comment out the following lines in .bashrc.

    # enable color support of ls and also add handy aliases
    #if [ -x /usr/bin/dircolors ]; then
    #    test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
    #    alias ls='ls --color=auto'
    #    #alias dir='dir --color=auto'
    #    #alias vdir='vdir --color=auto'
    #
    #    alias grep='grep --color=auto'
    #    alias fgrep='fgrep --color=auto'
    #    alias egrep='egrep --color=auto'
    #fi
    
  • Also if you want to see your own bash color meanings,then copy/paste the following codes in your terminal.

    eval $(echo "no:global default;fi:normal file;di:directory;ln:symbolic link;pi:named pipe;so:socket;do:door;bd:block device;cd:character device;or:orphan symlink;mi:missing file;su:set uid;sg:set gid;tw:sticky other writable;ow:other writable;st:sticky;ex:executable;"|sed -e 's/:/="/g; s/\;/"\n/g')           
    {      
      IFS=:     
      for i in $LS_COLORS     
      do        
        echo -e "\e[${i#*=}m$( x=${i%=*}; [ "${!x}" ] && echo "${!x}" || echo "$x" )\e[m" 
      done       
    } 
    

Output:
terminal output

Note:

Related Question