What do the different colors mean in ls?











up vote
313
down vote

favorite
182












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?










share|improve this question




























    up vote
    313
    down vote

    favorite
    182












    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?










    share|improve this question


























      up vote
      313
      down vote

      favorite
      182









      up vote
      313
      down vote

      favorite
      182






      182





      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?










      share|improve this question















      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?







      command-line colors ls






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Feb 16 '17 at 6:42









      luk3yx

      321215




      321215










      asked Dec 14 '10 at 8:15









      Rafid

      1,85251519




      1,85251519






















          5 Answers
          5






          active

          oldest

          votes

















          up vote
          331
          down vote



          accepted












          • Blue: Directory


          • Green: Executable or recognized data file


          • Sky Blue: Symbolic link file


          • Yellow with black background: Device


          • 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:
            alt text




          Note:




          • For more informations type man dir_colors in terminal.






          share|improve this answer



















          • 23




            That eval script showing the output color representation for each type is brilliant... thanks!
            – Russ
            Jul 27 '11 at 22:00






          • 2




            Pure sourcery ;)
            – Homunculus Reticulli
            Aug 4 '15 at 13:30






          • 4




            A more readable version of that eval script is here: github.com/gkotian/gautam_linux/blob/master/scripts/colours.sh
            – Gautam
            Sep 4 '16 at 17:41






          • 2




            Red is also a dead symlink.
            – Thomas Ward
            May 6 '17 at 16:17






          • 1




            what about files in normal white text?
            – S..
            Jul 15 '17 at 8:42


















          up vote
          90
          down vote













          You can find out what colours ls uses by looking at the $LS_COLORS variable:




          • Turquoise: audio files1

          • Bright Red: Archives and compressed files2

          • Purple: images and videos3


          In addition, files are colourised by attributes:



          alt text






          1. aac, au, flac, mid, midi, mka, mp3, mpc, ogg, ra, wav, axa, oga, spx, xspf.


          2. tar, tgz, arj, taz, lzh, lzma, tlz, txz, zip, z, Z, dz, gz, lz, xz, bz2, bz, tbz, tbz2, tz, deb, rpm, jar, rar, ace, zoo, cpio, 7z, rz.


          3. jpg, jpeg, gif, bmp, pbm, pgm, ppm, tga, xbm, xpm, tif, tiff, png, svg, svgz, mng, pcx, mov, mpg, mpeg, m2v, mkv, ogm, mp4, m4v, mp4v, vob, qt, nuv, wmv, asf, rm, rmvb, flc, avi, fli, flv, gl, dl, xcf, xwd, yuv, cgm, emf, axv, anx, ogv, ogx.





          All this information is contained in the output of dircolors --print-database, but its formatting is rather unreadable.



          Here's a technical explanation of what's happening:



          Example:



          CHR 40;33;01


          The colour code consists of three parts:





          • The first part before the semicolon represents the text style.




            • 00=none, 01=bold, 04=underscore, 05=blink, 07=reverse, 08=concealed.




          • The second and third part are the colour and the background color:




            • 30=black, 31=red, 32=green, 33=yellow, 34=blue, 35=magenta, 36=cyan, 37=white.




          Each part can be omitted, assuming starting on the left. i.e. "01" means bold, "01;31" means bold and red. And you would get your terminal to print in colour by escaping the instruction with 33[ and ending it with an m. 33, or 1B in hexadecimal, is the ASCII sign "ESCAPE" (a special character in the ASCII character set). Example:



          "33[1;31mHello World33[m"


          Prints "Hello World" in bright red.



          The command ls with the argument --color=auto (on Ubuntu, ls is an alias for ls --color=auto) goes through all the file names and tries first to match different types, like Executable, Pipe and so on. It then tries to match regular expressions like *.wav and prints the resulting filename, enclosed in these colour-changing instructions for bash.






          share|improve this answer























          • Thanks! I was looking at a Git topology visualization question and wondered why some of the characters were being printed.
            – pdp
            Jul 4 '15 at 8:11


















          up vote
          27
          down vote













          If you type dircolors (echo $LS_COLORS also works) from command line you will get a list of codes and colors for lots of filetypes in 1 line. dircolors --print-database shows them 1 line at a time. Here is a short list (I tried to put in the most important ones). At the bottom there is an explanation about what the different codes at the end of each lines represents:




          NORMAL 00 # global default, although everything should be something.
          FILE 00 # normal file
          DIR 01;34 # directory
          LINK 01;36 # symbolic link. (If you set this to 'target' instead of a
          # numerical value, the color is as for the file pointed to.)
          FIFO 40;33 # pipe
          SOCK 01;35 # socket
          DOOR 01;35 # door
          BLK 40;33;01 # block device driver
          CHR 40;33;01 # character device driver
          ORPHAN 40;31;01 # symlink to nonexistent file, or non-stat'able file
          SETUID 37;41 # file that is setuid (u+s)
          SETGID 30;43 # file that is setgid (g+s)
          STICKY_OTHER_WRITABLE 30;42 # dir that is sticky and other-writable (+t,o+w)
          OTHER_WRITABLE 34;42 # dir that is other-writable (o+w) and not sticky
          STICKY 37;44 # dir with the sticky bit set (+t) and not other-writable
          # archives or compressed (bright red)
          .tar 01;31
          .tgz 01;31
          # image formats
          .jpg 01;35
          .jpeg 01;35
          .gif 01;35
          .bmp 01;35
          # audio formats
          .aac 00;36
          .flac 00;36
          .ogg 00;36



          • Attribute codes: 00=none 01=bold 04=underscore 05=blink 07=reverse 08=concealed

          • Text color codes: 30=black 31=red 32=green 33=yellow 34=blue 35=magenta 36=cyan 37=white

          • Background color codes: 40=black 41=red 42=green 43=yellow 44=blue 45=magenta 46=cyan 47=white


          If you want to play around with this here is an example on how to set a color for a file:



          export LS_COLORS=$LS_COLORS:"*.ogg=01;35":"*.mp3=01;35"  


          This will set *.ogg and .mp3 to bold magenta. And if you put it in your .bashrc file it will become permanent.






          share|improve this answer

















          • 2




            Hey maybe someone else comes with a better answer. Btw you got me over 15k with this upvote ;)
            – Rinzwind
            Sep 14 '11 at 8:29










          • rock on! You got yourself there... Thanks again though, I did a /"string" to search up on some of the colors I was unsure about
            – user784637
            Sep 14 '11 at 8:38










          • This (excellent) answer was merged, in case you're wondering about the dates. :-)
            – Stefano Palazzo
            Sep 14 '11 at 10:06












          • @Rinzwind, so to set a color for pdf file, the process is to use export? Is it possible to simply add one extension in the default LS_COLORS variable?
            – Sigur
            Jan 28 '16 at 18:14


















          up vote
          17
          down vote













          None of the answers here include the 256 color options in the latest versions of Ubuntu. I'm color deficient (some colors give me trouble near each other) so the default blue directory on black is real hard for me to read. What follows is my research to change that.



          Type dircolors -p |less to see your current color code.



          The default .bashrc should already be configured not only to take advantage of the system color code, but also one in ~/.dircolors so dump the dircolors output to .dircolor so you can start with that using this command.
          dircolors -p > ~/.dircolors



          Alternative: pick up a very similar 256 color dircolors from seebi's solarized project.



          Grab this colortest script and run it with the command colortest -w so you can see all the colors at once. Choose a color. I like the orange #208. I want that to be the text color so using this info on extended color codes, I can apply that.



          So you have a color, now what. First we have to create the string.



          The first number will be an attribute code, most likely 00, but if you want it to blink go with 05:




          Pick an attribute code: 00=none 01=bold 04=underscore 05=blink 07=reverse 08=concealed




          Next pick append ;38;5; to that attribute code to indicate your text color to get 00;38;5; and then append your color. I picked 208 so I get 00;38;5;208.



          If you want to also put a background on it, pick another color (let's say 56) with the colortest script and the append ;48;5; for the background and 56 for the color to get a total string of 00;38;5;208;48;5;56.



          So now you have it, what do you do with it?



          vim ~/.dircolors and find the section you want to change (for me that is DIR) to the string we determined above "00;38;5;208".



          This won't apply immediately, you'll need to load the config. Use dircolors ~/.dircolors to the get code to set your LS_COLORS variable. You could just paste that into your terminal session or you can close your terminal and reopen it. You could also pipe that into a file and run it as a shell script.



          You can do this same procedure with 16 colors. You don't need the special ;38;5 or ;48;5 stuff. Just toss the numbers into the string and enjoy the simplicity.



          Thanks to Dan and seebi for their notes and code on this.






          share|improve this answer




























            up vote
            17
            down vote













            This expands on Karthick87's answer.





            With the default setup





            • Uncolored (white): file or non-filename text (e.g. permissions in the output of ls -l)


            • Bold blue: directory


            • Bold cyan: symbolic link


            • Bold green: executable file


            • Bold red: archive file


            • Bold magenta: image file, video, graphic, etc. or door or socket


            • Cyan: audio file


            • Yellow with black background: pipe (AKA FIFO)


            • Bold yellow with black background: block device or character device


            • Bold red with black background: orphan symlink or missing file


            • Uncolored with red background: set-user-ID file


            • Black with yellow background: set-group-ID file


            • Black with red background: file with capability


            • White with blue background: sticky directory


            • Blue with green background: other-writable directory


            • Black with green background: sticky and other-writable directory


            Script to show colors



            #!/bin/bash
            # For LS_COLORS, print type and description in the relevant color.

            IFS=:
            for ls_color in $LS_COLORS; do
            color="${ls_color#*=}"
            type="${ls_color%=*}"

            # Add descriptions for named types.
            case "$type" in
            bd) type+=" (block device)" ;;
            ca) type+=" (file with capability)" ;;
            cd) type+=" (character device)" ;;
            di) type+=" (directory)" ;;
            do) type+=" (door)" ;;
            ex) type+=" (executable file)" ;;
            fi) type+=" (regular file)" ;;
            ln) type+=" (symbolic link)" ;;
            mh) type+=" (multi-hardlink)" ;;
            mi) type+=" (missing file)" ;;
            no) type+=" (normal non-filename text)" ;;
            or) type+=" (orphan symlink)" ;;
            ow) type+=" (other-writable directory)" ;;
            pi) type+=" (named pipe, AKA FIFO)" ;;
            rs) type+=" (reset to no color)" ;;
            sg) type+=" (set-group-ID)" ;;
            so) type+=" (socket)" ;;
            st) type+=" (sticky directory)" ;;
            su) type+=" (set-user-ID)" ;;
            tw) type+=" (sticky and other-writable directory)" ;;
            esac

            # Separate each color with a newline.
            if [[ $color_prev ]] && [[ $color != $color_prev ]]; then
            echo
            fi

            printf "e[%sm%se[m " "$color" "$type"

            # For next loop
            color_prev="$color"
            done
            echo


            Output with default setup:



            gnome-terminal screenshot



            Output with my setup (custom dircolors and custom Solarized terminal theme):



            gnome-terminal screenshot



            I got the descriptions from dircolors -p and man dir_colors, and filled in the gaps with my own research.



            The colors and descriptions are the same from 14.04 to 17.10.






            share|improve this answer























            • How did you know rs means RESET, mh means MULTIHARDLINK, ca means CAPABILITY etc?
              – Fredrick Gauss
              Oct 4 '17 at 8:36










            • @FredrickGauss As I wrote in the answer, I got descriptions from running dircolors -p.
              – wjandrea
              Oct 4 '17 at 16:04










            • dircolors -p does not say rs is RESET 0 # reset to "normal" color .
              – Fredrick Gauss
              Oct 4 '17 at 16:38










            • @FredrickGauss Not explicitly, but "RESET" is the only one that can be abbreviated as "rs", and the color (0) matches.
              – wjandrea
              Oct 4 '17 at 16:45











            Your Answer








            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "89"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f17299%2fwhat-do-the-different-colors-mean-in-ls%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            5 Answers
            5






            active

            oldest

            votes








            5 Answers
            5






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            331
            down vote



            accepted












            • Blue: Directory


            • Green: Executable or recognized data file


            • Sky Blue: Symbolic link file


            • Yellow with black background: Device


            • 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:
              alt text




            Note:




            • For more informations type man dir_colors in terminal.






            share|improve this answer



















            • 23




              That eval script showing the output color representation for each type is brilliant... thanks!
              – Russ
              Jul 27 '11 at 22:00






            • 2




              Pure sourcery ;)
              – Homunculus Reticulli
              Aug 4 '15 at 13:30






            • 4




              A more readable version of that eval script is here: github.com/gkotian/gautam_linux/blob/master/scripts/colours.sh
              – Gautam
              Sep 4 '16 at 17:41






            • 2




              Red is also a dead symlink.
              – Thomas Ward
              May 6 '17 at 16:17






            • 1




              what about files in normal white text?
              – S..
              Jul 15 '17 at 8:42















            up vote
            331
            down vote



            accepted












            • Blue: Directory


            • Green: Executable or recognized data file


            • Sky Blue: Symbolic link file


            • Yellow with black background: Device


            • 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:
              alt text




            Note:




            • For more informations type man dir_colors in terminal.






            share|improve this answer



















            • 23




              That eval script showing the output color representation for each type is brilliant... thanks!
              – Russ
              Jul 27 '11 at 22:00






            • 2




              Pure sourcery ;)
              – Homunculus Reticulli
              Aug 4 '15 at 13:30






            • 4




              A more readable version of that eval script is here: github.com/gkotian/gautam_linux/blob/master/scripts/colours.sh
              – Gautam
              Sep 4 '16 at 17:41






            • 2




              Red is also a dead symlink.
              – Thomas Ward
              May 6 '17 at 16:17






            • 1




              what about files in normal white text?
              – S..
              Jul 15 '17 at 8:42













            up vote
            331
            down vote



            accepted







            up vote
            331
            down vote



            accepted








            • Blue: Directory


            • Green: Executable or recognized data file


            • Sky Blue: Symbolic link file


            • Yellow with black background: Device


            • 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:
              alt text




            Note:




            • For more informations type man dir_colors in terminal.






            share|improve this answer
















            • Blue: Directory


            • Green: Executable or recognized data file


            • Sky Blue: Symbolic link file


            • Yellow with black background: Device


            • 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:
              alt text




            Note:




            • For more informations type man dir_colors in terminal.







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Jan 29 at 19:42









            wjandrea

            8,14342258




            8,14342258










            answered Dec 14 '10 at 8:18









            karthick87

            47.3k53166217




            47.3k53166217








            • 23




              That eval script showing the output color representation for each type is brilliant... thanks!
              – Russ
              Jul 27 '11 at 22:00






            • 2




              Pure sourcery ;)
              – Homunculus Reticulli
              Aug 4 '15 at 13:30






            • 4




              A more readable version of that eval script is here: github.com/gkotian/gautam_linux/blob/master/scripts/colours.sh
              – Gautam
              Sep 4 '16 at 17:41






            • 2




              Red is also a dead symlink.
              – Thomas Ward
              May 6 '17 at 16:17






            • 1




              what about files in normal white text?
              – S..
              Jul 15 '17 at 8:42














            • 23




              That eval script showing the output color representation for each type is brilliant... thanks!
              – Russ
              Jul 27 '11 at 22:00






            • 2




              Pure sourcery ;)
              – Homunculus Reticulli
              Aug 4 '15 at 13:30






            • 4




              A more readable version of that eval script is here: github.com/gkotian/gautam_linux/blob/master/scripts/colours.sh
              – Gautam
              Sep 4 '16 at 17:41






            • 2




              Red is also a dead symlink.
              – Thomas Ward
              May 6 '17 at 16:17






            • 1




              what about files in normal white text?
              – S..
              Jul 15 '17 at 8:42








            23




            23




            That eval script showing the output color representation for each type is brilliant... thanks!
            – Russ
            Jul 27 '11 at 22:00




            That eval script showing the output color representation for each type is brilliant... thanks!
            – Russ
            Jul 27 '11 at 22:00




            2




            2




            Pure sourcery ;)
            – Homunculus Reticulli
            Aug 4 '15 at 13:30




            Pure sourcery ;)
            – Homunculus Reticulli
            Aug 4 '15 at 13:30




            4




            4




            A more readable version of that eval script is here: github.com/gkotian/gautam_linux/blob/master/scripts/colours.sh
            – Gautam
            Sep 4 '16 at 17:41




            A more readable version of that eval script is here: github.com/gkotian/gautam_linux/blob/master/scripts/colours.sh
            – Gautam
            Sep 4 '16 at 17:41




            2




            2




            Red is also a dead symlink.
            – Thomas Ward
            May 6 '17 at 16:17




            Red is also a dead symlink.
            – Thomas Ward
            May 6 '17 at 16:17




            1




            1




            what about files in normal white text?
            – S..
            Jul 15 '17 at 8:42




            what about files in normal white text?
            – S..
            Jul 15 '17 at 8:42












            up vote
            90
            down vote













            You can find out what colours ls uses by looking at the $LS_COLORS variable:




            • Turquoise: audio files1

            • Bright Red: Archives and compressed files2

            • Purple: images and videos3


            In addition, files are colourised by attributes:



            alt text






            1. aac, au, flac, mid, midi, mka, mp3, mpc, ogg, ra, wav, axa, oga, spx, xspf.


            2. tar, tgz, arj, taz, lzh, lzma, tlz, txz, zip, z, Z, dz, gz, lz, xz, bz2, bz, tbz, tbz2, tz, deb, rpm, jar, rar, ace, zoo, cpio, 7z, rz.


            3. jpg, jpeg, gif, bmp, pbm, pgm, ppm, tga, xbm, xpm, tif, tiff, png, svg, svgz, mng, pcx, mov, mpg, mpeg, m2v, mkv, ogm, mp4, m4v, mp4v, vob, qt, nuv, wmv, asf, rm, rmvb, flc, avi, fli, flv, gl, dl, xcf, xwd, yuv, cgm, emf, axv, anx, ogv, ogx.





            All this information is contained in the output of dircolors --print-database, but its formatting is rather unreadable.



            Here's a technical explanation of what's happening:



            Example:



            CHR 40;33;01


            The colour code consists of three parts:





            • The first part before the semicolon represents the text style.




              • 00=none, 01=bold, 04=underscore, 05=blink, 07=reverse, 08=concealed.




            • The second and third part are the colour and the background color:




              • 30=black, 31=red, 32=green, 33=yellow, 34=blue, 35=magenta, 36=cyan, 37=white.




            Each part can be omitted, assuming starting on the left. i.e. "01" means bold, "01;31" means bold and red. And you would get your terminal to print in colour by escaping the instruction with 33[ and ending it with an m. 33, or 1B in hexadecimal, is the ASCII sign "ESCAPE" (a special character in the ASCII character set). Example:



            "33[1;31mHello World33[m"


            Prints "Hello World" in bright red.



            The command ls with the argument --color=auto (on Ubuntu, ls is an alias for ls --color=auto) goes through all the file names and tries first to match different types, like Executable, Pipe and so on. It then tries to match regular expressions like *.wav and prints the resulting filename, enclosed in these colour-changing instructions for bash.






            share|improve this answer























            • Thanks! I was looking at a Git topology visualization question and wondered why some of the characters were being printed.
              – pdp
              Jul 4 '15 at 8:11















            up vote
            90
            down vote













            You can find out what colours ls uses by looking at the $LS_COLORS variable:




            • Turquoise: audio files1

            • Bright Red: Archives and compressed files2

            • Purple: images and videos3


            In addition, files are colourised by attributes:



            alt text






            1. aac, au, flac, mid, midi, mka, mp3, mpc, ogg, ra, wav, axa, oga, spx, xspf.


            2. tar, tgz, arj, taz, lzh, lzma, tlz, txz, zip, z, Z, dz, gz, lz, xz, bz2, bz, tbz, tbz2, tz, deb, rpm, jar, rar, ace, zoo, cpio, 7z, rz.


            3. jpg, jpeg, gif, bmp, pbm, pgm, ppm, tga, xbm, xpm, tif, tiff, png, svg, svgz, mng, pcx, mov, mpg, mpeg, m2v, mkv, ogm, mp4, m4v, mp4v, vob, qt, nuv, wmv, asf, rm, rmvb, flc, avi, fli, flv, gl, dl, xcf, xwd, yuv, cgm, emf, axv, anx, ogv, ogx.





            All this information is contained in the output of dircolors --print-database, but its formatting is rather unreadable.



            Here's a technical explanation of what's happening:



            Example:



            CHR 40;33;01


            The colour code consists of three parts:





            • The first part before the semicolon represents the text style.




              • 00=none, 01=bold, 04=underscore, 05=blink, 07=reverse, 08=concealed.




            • The second and third part are the colour and the background color:




              • 30=black, 31=red, 32=green, 33=yellow, 34=blue, 35=magenta, 36=cyan, 37=white.




            Each part can be omitted, assuming starting on the left. i.e. "01" means bold, "01;31" means bold and red. And you would get your terminal to print in colour by escaping the instruction with 33[ and ending it with an m. 33, or 1B in hexadecimal, is the ASCII sign "ESCAPE" (a special character in the ASCII character set). Example:



            "33[1;31mHello World33[m"


            Prints "Hello World" in bright red.



            The command ls with the argument --color=auto (on Ubuntu, ls is an alias for ls --color=auto) goes through all the file names and tries first to match different types, like Executable, Pipe and so on. It then tries to match regular expressions like *.wav and prints the resulting filename, enclosed in these colour-changing instructions for bash.






            share|improve this answer























            • Thanks! I was looking at a Git topology visualization question and wondered why some of the characters were being printed.
              – pdp
              Jul 4 '15 at 8:11













            up vote
            90
            down vote










            up vote
            90
            down vote









            You can find out what colours ls uses by looking at the $LS_COLORS variable:




            • Turquoise: audio files1

            • Bright Red: Archives and compressed files2

            • Purple: images and videos3


            In addition, files are colourised by attributes:



            alt text






            1. aac, au, flac, mid, midi, mka, mp3, mpc, ogg, ra, wav, axa, oga, spx, xspf.


            2. tar, tgz, arj, taz, lzh, lzma, tlz, txz, zip, z, Z, dz, gz, lz, xz, bz2, bz, tbz, tbz2, tz, deb, rpm, jar, rar, ace, zoo, cpio, 7z, rz.


            3. jpg, jpeg, gif, bmp, pbm, pgm, ppm, tga, xbm, xpm, tif, tiff, png, svg, svgz, mng, pcx, mov, mpg, mpeg, m2v, mkv, ogm, mp4, m4v, mp4v, vob, qt, nuv, wmv, asf, rm, rmvb, flc, avi, fli, flv, gl, dl, xcf, xwd, yuv, cgm, emf, axv, anx, ogv, ogx.





            All this information is contained in the output of dircolors --print-database, but its formatting is rather unreadable.



            Here's a technical explanation of what's happening:



            Example:



            CHR 40;33;01


            The colour code consists of three parts:





            • The first part before the semicolon represents the text style.




              • 00=none, 01=bold, 04=underscore, 05=blink, 07=reverse, 08=concealed.




            • The second and third part are the colour and the background color:




              • 30=black, 31=red, 32=green, 33=yellow, 34=blue, 35=magenta, 36=cyan, 37=white.




            Each part can be omitted, assuming starting on the left. i.e. "01" means bold, "01;31" means bold and red. And you would get your terminal to print in colour by escaping the instruction with 33[ and ending it with an m. 33, or 1B in hexadecimal, is the ASCII sign "ESCAPE" (a special character in the ASCII character set). Example:



            "33[1;31mHello World33[m"


            Prints "Hello World" in bright red.



            The command ls with the argument --color=auto (on Ubuntu, ls is an alias for ls --color=auto) goes through all the file names and tries first to match different types, like Executable, Pipe and so on. It then tries to match regular expressions like *.wav and prints the resulting filename, enclosed in these colour-changing instructions for bash.






            share|improve this answer














            You can find out what colours ls uses by looking at the $LS_COLORS variable:




            • Turquoise: audio files1

            • Bright Red: Archives and compressed files2

            • Purple: images and videos3


            In addition, files are colourised by attributes:



            alt text






            1. aac, au, flac, mid, midi, mka, mp3, mpc, ogg, ra, wav, axa, oga, spx, xspf.


            2. tar, tgz, arj, taz, lzh, lzma, tlz, txz, zip, z, Z, dz, gz, lz, xz, bz2, bz, tbz, tbz2, tz, deb, rpm, jar, rar, ace, zoo, cpio, 7z, rz.


            3. jpg, jpeg, gif, bmp, pbm, pgm, ppm, tga, xbm, xpm, tif, tiff, png, svg, svgz, mng, pcx, mov, mpg, mpeg, m2v, mkv, ogm, mp4, m4v, mp4v, vob, qt, nuv, wmv, asf, rm, rmvb, flc, avi, fli, flv, gl, dl, xcf, xwd, yuv, cgm, emf, axv, anx, ogv, ogx.





            All this information is contained in the output of dircolors --print-database, but its formatting is rather unreadable.



            Here's a technical explanation of what's happening:



            Example:



            CHR 40;33;01


            The colour code consists of three parts:





            • The first part before the semicolon represents the text style.




              • 00=none, 01=bold, 04=underscore, 05=blink, 07=reverse, 08=concealed.




            • The second and third part are the colour and the background color:




              • 30=black, 31=red, 32=green, 33=yellow, 34=blue, 35=magenta, 36=cyan, 37=white.




            Each part can be omitted, assuming starting on the left. i.e. "01" means bold, "01;31" means bold and red. And you would get your terminal to print in colour by escaping the instruction with 33[ and ending it with an m. 33, or 1B in hexadecimal, is the ASCII sign "ESCAPE" (a special character in the ASCII character set). Example:



            "33[1;31mHello World33[m"


            Prints "Hello World" in bright red.



            The command ls with the argument --color=auto (on Ubuntu, ls is an alias for ls --color=auto) goes through all the file names and tries first to match different types, like Executable, Pipe and so on. It then tries to match regular expressions like *.wav and prints the resulting filename, enclosed in these colour-changing instructions for bash.







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited May 12 '16 at 22:14









            muru

            136k20291493




            136k20291493










            answered Dec 14 '10 at 8:57









            Stefano Palazzo

            62.2k33183216




            62.2k33183216












            • Thanks! I was looking at a Git topology visualization question and wondered why some of the characters were being printed.
              – pdp
              Jul 4 '15 at 8:11


















            • Thanks! I was looking at a Git topology visualization question and wondered why some of the characters were being printed.
              – pdp
              Jul 4 '15 at 8:11
















            Thanks! I was looking at a Git topology visualization question and wondered why some of the characters were being printed.
            – pdp
            Jul 4 '15 at 8:11




            Thanks! I was looking at a Git topology visualization question and wondered why some of the characters were being printed.
            – pdp
            Jul 4 '15 at 8:11










            up vote
            27
            down vote













            If you type dircolors (echo $LS_COLORS also works) from command line you will get a list of codes and colors for lots of filetypes in 1 line. dircolors --print-database shows them 1 line at a time. Here is a short list (I tried to put in the most important ones). At the bottom there is an explanation about what the different codes at the end of each lines represents:




            NORMAL 00 # global default, although everything should be something.
            FILE 00 # normal file
            DIR 01;34 # directory
            LINK 01;36 # symbolic link. (If you set this to 'target' instead of a
            # numerical value, the color is as for the file pointed to.)
            FIFO 40;33 # pipe
            SOCK 01;35 # socket
            DOOR 01;35 # door
            BLK 40;33;01 # block device driver
            CHR 40;33;01 # character device driver
            ORPHAN 40;31;01 # symlink to nonexistent file, or non-stat'able file
            SETUID 37;41 # file that is setuid (u+s)
            SETGID 30;43 # file that is setgid (g+s)
            STICKY_OTHER_WRITABLE 30;42 # dir that is sticky and other-writable (+t,o+w)
            OTHER_WRITABLE 34;42 # dir that is other-writable (o+w) and not sticky
            STICKY 37;44 # dir with the sticky bit set (+t) and not other-writable
            # archives or compressed (bright red)
            .tar 01;31
            .tgz 01;31
            # image formats
            .jpg 01;35
            .jpeg 01;35
            .gif 01;35
            .bmp 01;35
            # audio formats
            .aac 00;36
            .flac 00;36
            .ogg 00;36



            • Attribute codes: 00=none 01=bold 04=underscore 05=blink 07=reverse 08=concealed

            • Text color codes: 30=black 31=red 32=green 33=yellow 34=blue 35=magenta 36=cyan 37=white

            • Background color codes: 40=black 41=red 42=green 43=yellow 44=blue 45=magenta 46=cyan 47=white


            If you want to play around with this here is an example on how to set a color for a file:



            export LS_COLORS=$LS_COLORS:"*.ogg=01;35":"*.mp3=01;35"  


            This will set *.ogg and .mp3 to bold magenta. And if you put it in your .bashrc file it will become permanent.






            share|improve this answer

















            • 2




              Hey maybe someone else comes with a better answer. Btw you got me over 15k with this upvote ;)
              – Rinzwind
              Sep 14 '11 at 8:29










            • rock on! You got yourself there... Thanks again though, I did a /"string" to search up on some of the colors I was unsure about
              – user784637
              Sep 14 '11 at 8:38










            • This (excellent) answer was merged, in case you're wondering about the dates. :-)
              – Stefano Palazzo
              Sep 14 '11 at 10:06












            • @Rinzwind, so to set a color for pdf file, the process is to use export? Is it possible to simply add one extension in the default LS_COLORS variable?
              – Sigur
              Jan 28 '16 at 18:14















            up vote
            27
            down vote













            If you type dircolors (echo $LS_COLORS also works) from command line you will get a list of codes and colors for lots of filetypes in 1 line. dircolors --print-database shows them 1 line at a time. Here is a short list (I tried to put in the most important ones). At the bottom there is an explanation about what the different codes at the end of each lines represents:




            NORMAL 00 # global default, although everything should be something.
            FILE 00 # normal file
            DIR 01;34 # directory
            LINK 01;36 # symbolic link. (If you set this to 'target' instead of a
            # numerical value, the color is as for the file pointed to.)
            FIFO 40;33 # pipe
            SOCK 01;35 # socket
            DOOR 01;35 # door
            BLK 40;33;01 # block device driver
            CHR 40;33;01 # character device driver
            ORPHAN 40;31;01 # symlink to nonexistent file, or non-stat'able file
            SETUID 37;41 # file that is setuid (u+s)
            SETGID 30;43 # file that is setgid (g+s)
            STICKY_OTHER_WRITABLE 30;42 # dir that is sticky and other-writable (+t,o+w)
            OTHER_WRITABLE 34;42 # dir that is other-writable (o+w) and not sticky
            STICKY 37;44 # dir with the sticky bit set (+t) and not other-writable
            # archives or compressed (bright red)
            .tar 01;31
            .tgz 01;31
            # image formats
            .jpg 01;35
            .jpeg 01;35
            .gif 01;35
            .bmp 01;35
            # audio formats
            .aac 00;36
            .flac 00;36
            .ogg 00;36



            • Attribute codes: 00=none 01=bold 04=underscore 05=blink 07=reverse 08=concealed

            • Text color codes: 30=black 31=red 32=green 33=yellow 34=blue 35=magenta 36=cyan 37=white

            • Background color codes: 40=black 41=red 42=green 43=yellow 44=blue 45=magenta 46=cyan 47=white


            If you want to play around with this here is an example on how to set a color for a file:



            export LS_COLORS=$LS_COLORS:"*.ogg=01;35":"*.mp3=01;35"  


            This will set *.ogg and .mp3 to bold magenta. And if you put it in your .bashrc file it will become permanent.






            share|improve this answer

















            • 2




              Hey maybe someone else comes with a better answer. Btw you got me over 15k with this upvote ;)
              – Rinzwind
              Sep 14 '11 at 8:29










            • rock on! You got yourself there... Thanks again though, I did a /"string" to search up on some of the colors I was unsure about
              – user784637
              Sep 14 '11 at 8:38










            • This (excellent) answer was merged, in case you're wondering about the dates. :-)
              – Stefano Palazzo
              Sep 14 '11 at 10:06












            • @Rinzwind, so to set a color for pdf file, the process is to use export? Is it possible to simply add one extension in the default LS_COLORS variable?
              – Sigur
              Jan 28 '16 at 18:14













            up vote
            27
            down vote










            up vote
            27
            down vote









            If you type dircolors (echo $LS_COLORS also works) from command line you will get a list of codes and colors for lots of filetypes in 1 line. dircolors --print-database shows them 1 line at a time. Here is a short list (I tried to put in the most important ones). At the bottom there is an explanation about what the different codes at the end of each lines represents:




            NORMAL 00 # global default, although everything should be something.
            FILE 00 # normal file
            DIR 01;34 # directory
            LINK 01;36 # symbolic link. (If you set this to 'target' instead of a
            # numerical value, the color is as for the file pointed to.)
            FIFO 40;33 # pipe
            SOCK 01;35 # socket
            DOOR 01;35 # door
            BLK 40;33;01 # block device driver
            CHR 40;33;01 # character device driver
            ORPHAN 40;31;01 # symlink to nonexistent file, or non-stat'able file
            SETUID 37;41 # file that is setuid (u+s)
            SETGID 30;43 # file that is setgid (g+s)
            STICKY_OTHER_WRITABLE 30;42 # dir that is sticky and other-writable (+t,o+w)
            OTHER_WRITABLE 34;42 # dir that is other-writable (o+w) and not sticky
            STICKY 37;44 # dir with the sticky bit set (+t) and not other-writable
            # archives or compressed (bright red)
            .tar 01;31
            .tgz 01;31
            # image formats
            .jpg 01;35
            .jpeg 01;35
            .gif 01;35
            .bmp 01;35
            # audio formats
            .aac 00;36
            .flac 00;36
            .ogg 00;36



            • Attribute codes: 00=none 01=bold 04=underscore 05=blink 07=reverse 08=concealed

            • Text color codes: 30=black 31=red 32=green 33=yellow 34=blue 35=magenta 36=cyan 37=white

            • Background color codes: 40=black 41=red 42=green 43=yellow 44=blue 45=magenta 46=cyan 47=white


            If you want to play around with this here is an example on how to set a color for a file:



            export LS_COLORS=$LS_COLORS:"*.ogg=01;35":"*.mp3=01;35"  


            This will set *.ogg and .mp3 to bold magenta. And if you put it in your .bashrc file it will become permanent.






            share|improve this answer












            If you type dircolors (echo $LS_COLORS also works) from command line you will get a list of codes and colors for lots of filetypes in 1 line. dircolors --print-database shows them 1 line at a time. Here is a short list (I tried to put in the most important ones). At the bottom there is an explanation about what the different codes at the end of each lines represents:




            NORMAL 00 # global default, although everything should be something.
            FILE 00 # normal file
            DIR 01;34 # directory
            LINK 01;36 # symbolic link. (If you set this to 'target' instead of a
            # numerical value, the color is as for the file pointed to.)
            FIFO 40;33 # pipe
            SOCK 01;35 # socket
            DOOR 01;35 # door
            BLK 40;33;01 # block device driver
            CHR 40;33;01 # character device driver
            ORPHAN 40;31;01 # symlink to nonexistent file, or non-stat'able file
            SETUID 37;41 # file that is setuid (u+s)
            SETGID 30;43 # file that is setgid (g+s)
            STICKY_OTHER_WRITABLE 30;42 # dir that is sticky and other-writable (+t,o+w)
            OTHER_WRITABLE 34;42 # dir that is other-writable (o+w) and not sticky
            STICKY 37;44 # dir with the sticky bit set (+t) and not other-writable
            # archives or compressed (bright red)
            .tar 01;31
            .tgz 01;31
            # image formats
            .jpg 01;35
            .jpeg 01;35
            .gif 01;35
            .bmp 01;35
            # audio formats
            .aac 00;36
            .flac 00;36
            .ogg 00;36



            • Attribute codes: 00=none 01=bold 04=underscore 05=blink 07=reverse 08=concealed

            • Text color codes: 30=black 31=red 32=green 33=yellow 34=blue 35=magenta 36=cyan 37=white

            • Background color codes: 40=black 41=red 42=green 43=yellow 44=blue 45=magenta 46=cyan 47=white


            If you want to play around with this here is an example on how to set a color for a file:



            export LS_COLORS=$LS_COLORS:"*.ogg=01;35":"*.mp3=01;35"  


            This will set *.ogg and .mp3 to bold magenta. And if you put it in your .bashrc file it will become permanent.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Sep 14 '11 at 8:25









            Rinzwind

            203k27388522




            203k27388522








            • 2




              Hey maybe someone else comes with a better answer. Btw you got me over 15k with this upvote ;)
              – Rinzwind
              Sep 14 '11 at 8:29










            • rock on! You got yourself there... Thanks again though, I did a /"string" to search up on some of the colors I was unsure about
              – user784637
              Sep 14 '11 at 8:38










            • This (excellent) answer was merged, in case you're wondering about the dates. :-)
              – Stefano Palazzo
              Sep 14 '11 at 10:06












            • @Rinzwind, so to set a color for pdf file, the process is to use export? Is it possible to simply add one extension in the default LS_COLORS variable?
              – Sigur
              Jan 28 '16 at 18:14














            • 2




              Hey maybe someone else comes with a better answer. Btw you got me over 15k with this upvote ;)
              – Rinzwind
              Sep 14 '11 at 8:29










            • rock on! You got yourself there... Thanks again though, I did a /"string" to search up on some of the colors I was unsure about
              – user784637
              Sep 14 '11 at 8:38










            • This (excellent) answer was merged, in case you're wondering about the dates. :-)
              – Stefano Palazzo
              Sep 14 '11 at 10:06












            • @Rinzwind, so to set a color for pdf file, the process is to use export? Is it possible to simply add one extension in the default LS_COLORS variable?
              – Sigur
              Jan 28 '16 at 18:14








            2




            2




            Hey maybe someone else comes with a better answer. Btw you got me over 15k with this upvote ;)
            – Rinzwind
            Sep 14 '11 at 8:29




            Hey maybe someone else comes with a better answer. Btw you got me over 15k with this upvote ;)
            – Rinzwind
            Sep 14 '11 at 8:29












            rock on! You got yourself there... Thanks again though, I did a /"string" to search up on some of the colors I was unsure about
            – user784637
            Sep 14 '11 at 8:38




            rock on! You got yourself there... Thanks again though, I did a /"string" to search up on some of the colors I was unsure about
            – user784637
            Sep 14 '11 at 8:38












            This (excellent) answer was merged, in case you're wondering about the dates. :-)
            – Stefano Palazzo
            Sep 14 '11 at 10:06






            This (excellent) answer was merged, in case you're wondering about the dates. :-)
            – Stefano Palazzo
            Sep 14 '11 at 10:06














            @Rinzwind, so to set a color for pdf file, the process is to use export? Is it possible to simply add one extension in the default LS_COLORS variable?
            – Sigur
            Jan 28 '16 at 18:14




            @Rinzwind, so to set a color for pdf file, the process is to use export? Is it possible to simply add one extension in the default LS_COLORS variable?
            – Sigur
            Jan 28 '16 at 18:14










            up vote
            17
            down vote













            None of the answers here include the 256 color options in the latest versions of Ubuntu. I'm color deficient (some colors give me trouble near each other) so the default blue directory on black is real hard for me to read. What follows is my research to change that.



            Type dircolors -p |less to see your current color code.



            The default .bashrc should already be configured not only to take advantage of the system color code, but also one in ~/.dircolors so dump the dircolors output to .dircolor so you can start with that using this command.
            dircolors -p > ~/.dircolors



            Alternative: pick up a very similar 256 color dircolors from seebi's solarized project.



            Grab this colortest script and run it with the command colortest -w so you can see all the colors at once. Choose a color. I like the orange #208. I want that to be the text color so using this info on extended color codes, I can apply that.



            So you have a color, now what. First we have to create the string.



            The first number will be an attribute code, most likely 00, but if you want it to blink go with 05:




            Pick an attribute code: 00=none 01=bold 04=underscore 05=blink 07=reverse 08=concealed




            Next pick append ;38;5; to that attribute code to indicate your text color to get 00;38;5; and then append your color. I picked 208 so I get 00;38;5;208.



            If you want to also put a background on it, pick another color (let's say 56) with the colortest script and the append ;48;5; for the background and 56 for the color to get a total string of 00;38;5;208;48;5;56.



            So now you have it, what do you do with it?



            vim ~/.dircolors and find the section you want to change (for me that is DIR) to the string we determined above "00;38;5;208".



            This won't apply immediately, you'll need to load the config. Use dircolors ~/.dircolors to the get code to set your LS_COLORS variable. You could just paste that into your terminal session or you can close your terminal and reopen it. You could also pipe that into a file and run it as a shell script.



            You can do this same procedure with 16 colors. You don't need the special ;38;5 or ;48;5 stuff. Just toss the numbers into the string and enjoy the simplicity.



            Thanks to Dan and seebi for their notes and code on this.






            share|improve this answer

























              up vote
              17
              down vote













              None of the answers here include the 256 color options in the latest versions of Ubuntu. I'm color deficient (some colors give me trouble near each other) so the default blue directory on black is real hard for me to read. What follows is my research to change that.



              Type dircolors -p |less to see your current color code.



              The default .bashrc should already be configured not only to take advantage of the system color code, but also one in ~/.dircolors so dump the dircolors output to .dircolor so you can start with that using this command.
              dircolors -p > ~/.dircolors



              Alternative: pick up a very similar 256 color dircolors from seebi's solarized project.



              Grab this colortest script and run it with the command colortest -w so you can see all the colors at once. Choose a color. I like the orange #208. I want that to be the text color so using this info on extended color codes, I can apply that.



              So you have a color, now what. First we have to create the string.



              The first number will be an attribute code, most likely 00, but if you want it to blink go with 05:




              Pick an attribute code: 00=none 01=bold 04=underscore 05=blink 07=reverse 08=concealed




              Next pick append ;38;5; to that attribute code to indicate your text color to get 00;38;5; and then append your color. I picked 208 so I get 00;38;5;208.



              If you want to also put a background on it, pick another color (let's say 56) with the colortest script and the append ;48;5; for the background and 56 for the color to get a total string of 00;38;5;208;48;5;56.



              So now you have it, what do you do with it?



              vim ~/.dircolors and find the section you want to change (for me that is DIR) to the string we determined above "00;38;5;208".



              This won't apply immediately, you'll need to load the config. Use dircolors ~/.dircolors to the get code to set your LS_COLORS variable. You could just paste that into your terminal session or you can close your terminal and reopen it. You could also pipe that into a file and run it as a shell script.



              You can do this same procedure with 16 colors. You don't need the special ;38;5 or ;48;5 stuff. Just toss the numbers into the string and enjoy the simplicity.



              Thanks to Dan and seebi for their notes and code on this.






              share|improve this answer























                up vote
                17
                down vote










                up vote
                17
                down vote









                None of the answers here include the 256 color options in the latest versions of Ubuntu. I'm color deficient (some colors give me trouble near each other) so the default blue directory on black is real hard for me to read. What follows is my research to change that.



                Type dircolors -p |less to see your current color code.



                The default .bashrc should already be configured not only to take advantage of the system color code, but also one in ~/.dircolors so dump the dircolors output to .dircolor so you can start with that using this command.
                dircolors -p > ~/.dircolors



                Alternative: pick up a very similar 256 color dircolors from seebi's solarized project.



                Grab this colortest script and run it with the command colortest -w so you can see all the colors at once. Choose a color. I like the orange #208. I want that to be the text color so using this info on extended color codes, I can apply that.



                So you have a color, now what. First we have to create the string.



                The first number will be an attribute code, most likely 00, but if you want it to blink go with 05:




                Pick an attribute code: 00=none 01=bold 04=underscore 05=blink 07=reverse 08=concealed




                Next pick append ;38;5; to that attribute code to indicate your text color to get 00;38;5; and then append your color. I picked 208 so I get 00;38;5;208.



                If you want to also put a background on it, pick another color (let's say 56) with the colortest script and the append ;48;5; for the background and 56 for the color to get a total string of 00;38;5;208;48;5;56.



                So now you have it, what do you do with it?



                vim ~/.dircolors and find the section you want to change (for me that is DIR) to the string we determined above "00;38;5;208".



                This won't apply immediately, you'll need to load the config. Use dircolors ~/.dircolors to the get code to set your LS_COLORS variable. You could just paste that into your terminal session or you can close your terminal and reopen it. You could also pipe that into a file and run it as a shell script.



                You can do this same procedure with 16 colors. You don't need the special ;38;5 or ;48;5 stuff. Just toss the numbers into the string and enjoy the simplicity.



                Thanks to Dan and seebi for their notes and code on this.






                share|improve this answer












                None of the answers here include the 256 color options in the latest versions of Ubuntu. I'm color deficient (some colors give me trouble near each other) so the default blue directory on black is real hard for me to read. What follows is my research to change that.



                Type dircolors -p |less to see your current color code.



                The default .bashrc should already be configured not only to take advantage of the system color code, but also one in ~/.dircolors so dump the dircolors output to .dircolor so you can start with that using this command.
                dircolors -p > ~/.dircolors



                Alternative: pick up a very similar 256 color dircolors from seebi's solarized project.



                Grab this colortest script and run it with the command colortest -w so you can see all the colors at once. Choose a color. I like the orange #208. I want that to be the text color so using this info on extended color codes, I can apply that.



                So you have a color, now what. First we have to create the string.



                The first number will be an attribute code, most likely 00, but if you want it to blink go with 05:




                Pick an attribute code: 00=none 01=bold 04=underscore 05=blink 07=reverse 08=concealed




                Next pick append ;38;5; to that attribute code to indicate your text color to get 00;38;5; and then append your color. I picked 208 so I get 00;38;5;208.



                If you want to also put a background on it, pick another color (let's say 56) with the colortest script and the append ;48;5; for the background and 56 for the color to get a total string of 00;38;5;208;48;5;56.



                So now you have it, what do you do with it?



                vim ~/.dircolors and find the section you want to change (for me that is DIR) to the string we determined above "00;38;5;208".



                This won't apply immediately, you'll need to load the config. Use dircolors ~/.dircolors to the get code to set your LS_COLORS variable. You could just paste that into your terminal session or you can close your terminal and reopen it. You could also pipe that into a file and run it as a shell script.



                You can do this same procedure with 16 colors. You don't need the special ;38;5 or ;48;5 stuff. Just toss the numbers into the string and enjoy the simplicity.



                Thanks to Dan and seebi for their notes and code on this.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Mar 22 '13 at 20:45









                flickerfly

                4,68262043




                4,68262043






















                    up vote
                    17
                    down vote













                    This expands on Karthick87's answer.





                    With the default setup





                    • Uncolored (white): file or non-filename text (e.g. permissions in the output of ls -l)


                    • Bold blue: directory


                    • Bold cyan: symbolic link


                    • Bold green: executable file


                    • Bold red: archive file


                    • Bold magenta: image file, video, graphic, etc. or door or socket


                    • Cyan: audio file


                    • Yellow with black background: pipe (AKA FIFO)


                    • Bold yellow with black background: block device or character device


                    • Bold red with black background: orphan symlink or missing file


                    • Uncolored with red background: set-user-ID file


                    • Black with yellow background: set-group-ID file


                    • Black with red background: file with capability


                    • White with blue background: sticky directory


                    • Blue with green background: other-writable directory


                    • Black with green background: sticky and other-writable directory


                    Script to show colors



                    #!/bin/bash
                    # For LS_COLORS, print type and description in the relevant color.

                    IFS=:
                    for ls_color in $LS_COLORS; do
                    color="${ls_color#*=}"
                    type="${ls_color%=*}"

                    # Add descriptions for named types.
                    case "$type" in
                    bd) type+=" (block device)" ;;
                    ca) type+=" (file with capability)" ;;
                    cd) type+=" (character device)" ;;
                    di) type+=" (directory)" ;;
                    do) type+=" (door)" ;;
                    ex) type+=" (executable file)" ;;
                    fi) type+=" (regular file)" ;;
                    ln) type+=" (symbolic link)" ;;
                    mh) type+=" (multi-hardlink)" ;;
                    mi) type+=" (missing file)" ;;
                    no) type+=" (normal non-filename text)" ;;
                    or) type+=" (orphan symlink)" ;;
                    ow) type+=" (other-writable directory)" ;;
                    pi) type+=" (named pipe, AKA FIFO)" ;;
                    rs) type+=" (reset to no color)" ;;
                    sg) type+=" (set-group-ID)" ;;
                    so) type+=" (socket)" ;;
                    st) type+=" (sticky directory)" ;;
                    su) type+=" (set-user-ID)" ;;
                    tw) type+=" (sticky and other-writable directory)" ;;
                    esac

                    # Separate each color with a newline.
                    if [[ $color_prev ]] && [[ $color != $color_prev ]]; then
                    echo
                    fi

                    printf "e[%sm%se[m " "$color" "$type"

                    # For next loop
                    color_prev="$color"
                    done
                    echo


                    Output with default setup:



                    gnome-terminal screenshot



                    Output with my setup (custom dircolors and custom Solarized terminal theme):



                    gnome-terminal screenshot



                    I got the descriptions from dircolors -p and man dir_colors, and filled in the gaps with my own research.



                    The colors and descriptions are the same from 14.04 to 17.10.






                    share|improve this answer























                    • How did you know rs means RESET, mh means MULTIHARDLINK, ca means CAPABILITY etc?
                      – Fredrick Gauss
                      Oct 4 '17 at 8:36










                    • @FredrickGauss As I wrote in the answer, I got descriptions from running dircolors -p.
                      – wjandrea
                      Oct 4 '17 at 16:04










                    • dircolors -p does not say rs is RESET 0 # reset to "normal" color .
                      – Fredrick Gauss
                      Oct 4 '17 at 16:38










                    • @FredrickGauss Not explicitly, but "RESET" is the only one that can be abbreviated as "rs", and the color (0) matches.
                      – wjandrea
                      Oct 4 '17 at 16:45















                    up vote
                    17
                    down vote













                    This expands on Karthick87's answer.





                    With the default setup





                    • Uncolored (white): file or non-filename text (e.g. permissions in the output of ls -l)


                    • Bold blue: directory


                    • Bold cyan: symbolic link


                    • Bold green: executable file


                    • Bold red: archive file


                    • Bold magenta: image file, video, graphic, etc. or door or socket


                    • Cyan: audio file


                    • Yellow with black background: pipe (AKA FIFO)


                    • Bold yellow with black background: block device or character device


                    • Bold red with black background: orphan symlink or missing file


                    • Uncolored with red background: set-user-ID file


                    • Black with yellow background: set-group-ID file


                    • Black with red background: file with capability


                    • White with blue background: sticky directory


                    • Blue with green background: other-writable directory


                    • Black with green background: sticky and other-writable directory


                    Script to show colors



                    #!/bin/bash
                    # For LS_COLORS, print type and description in the relevant color.

                    IFS=:
                    for ls_color in $LS_COLORS; do
                    color="${ls_color#*=}"
                    type="${ls_color%=*}"

                    # Add descriptions for named types.
                    case "$type" in
                    bd) type+=" (block device)" ;;
                    ca) type+=" (file with capability)" ;;
                    cd) type+=" (character device)" ;;
                    di) type+=" (directory)" ;;
                    do) type+=" (door)" ;;
                    ex) type+=" (executable file)" ;;
                    fi) type+=" (regular file)" ;;
                    ln) type+=" (symbolic link)" ;;
                    mh) type+=" (multi-hardlink)" ;;
                    mi) type+=" (missing file)" ;;
                    no) type+=" (normal non-filename text)" ;;
                    or) type+=" (orphan symlink)" ;;
                    ow) type+=" (other-writable directory)" ;;
                    pi) type+=" (named pipe, AKA FIFO)" ;;
                    rs) type+=" (reset to no color)" ;;
                    sg) type+=" (set-group-ID)" ;;
                    so) type+=" (socket)" ;;
                    st) type+=" (sticky directory)" ;;
                    su) type+=" (set-user-ID)" ;;
                    tw) type+=" (sticky and other-writable directory)" ;;
                    esac

                    # Separate each color with a newline.
                    if [[ $color_prev ]] && [[ $color != $color_prev ]]; then
                    echo
                    fi

                    printf "e[%sm%se[m " "$color" "$type"

                    # For next loop
                    color_prev="$color"
                    done
                    echo


                    Output with default setup:



                    gnome-terminal screenshot



                    Output with my setup (custom dircolors and custom Solarized terminal theme):



                    gnome-terminal screenshot



                    I got the descriptions from dircolors -p and man dir_colors, and filled in the gaps with my own research.



                    The colors and descriptions are the same from 14.04 to 17.10.






                    share|improve this answer























                    • How did you know rs means RESET, mh means MULTIHARDLINK, ca means CAPABILITY etc?
                      – Fredrick Gauss
                      Oct 4 '17 at 8:36










                    • @FredrickGauss As I wrote in the answer, I got descriptions from running dircolors -p.
                      – wjandrea
                      Oct 4 '17 at 16:04










                    • dircolors -p does not say rs is RESET 0 # reset to "normal" color .
                      – Fredrick Gauss
                      Oct 4 '17 at 16:38










                    • @FredrickGauss Not explicitly, but "RESET" is the only one that can be abbreviated as "rs", and the color (0) matches.
                      – wjandrea
                      Oct 4 '17 at 16:45













                    up vote
                    17
                    down vote










                    up vote
                    17
                    down vote









                    This expands on Karthick87's answer.





                    With the default setup





                    • Uncolored (white): file or non-filename text (e.g. permissions in the output of ls -l)


                    • Bold blue: directory


                    • Bold cyan: symbolic link


                    • Bold green: executable file


                    • Bold red: archive file


                    • Bold magenta: image file, video, graphic, etc. or door or socket


                    • Cyan: audio file


                    • Yellow with black background: pipe (AKA FIFO)


                    • Bold yellow with black background: block device or character device


                    • Bold red with black background: orphan symlink or missing file


                    • Uncolored with red background: set-user-ID file


                    • Black with yellow background: set-group-ID file


                    • Black with red background: file with capability


                    • White with blue background: sticky directory


                    • Blue with green background: other-writable directory


                    • Black with green background: sticky and other-writable directory


                    Script to show colors



                    #!/bin/bash
                    # For LS_COLORS, print type and description in the relevant color.

                    IFS=:
                    for ls_color in $LS_COLORS; do
                    color="${ls_color#*=}"
                    type="${ls_color%=*}"

                    # Add descriptions for named types.
                    case "$type" in
                    bd) type+=" (block device)" ;;
                    ca) type+=" (file with capability)" ;;
                    cd) type+=" (character device)" ;;
                    di) type+=" (directory)" ;;
                    do) type+=" (door)" ;;
                    ex) type+=" (executable file)" ;;
                    fi) type+=" (regular file)" ;;
                    ln) type+=" (symbolic link)" ;;
                    mh) type+=" (multi-hardlink)" ;;
                    mi) type+=" (missing file)" ;;
                    no) type+=" (normal non-filename text)" ;;
                    or) type+=" (orphan symlink)" ;;
                    ow) type+=" (other-writable directory)" ;;
                    pi) type+=" (named pipe, AKA FIFO)" ;;
                    rs) type+=" (reset to no color)" ;;
                    sg) type+=" (set-group-ID)" ;;
                    so) type+=" (socket)" ;;
                    st) type+=" (sticky directory)" ;;
                    su) type+=" (set-user-ID)" ;;
                    tw) type+=" (sticky and other-writable directory)" ;;
                    esac

                    # Separate each color with a newline.
                    if [[ $color_prev ]] && [[ $color != $color_prev ]]; then
                    echo
                    fi

                    printf "e[%sm%se[m " "$color" "$type"

                    # For next loop
                    color_prev="$color"
                    done
                    echo


                    Output with default setup:



                    gnome-terminal screenshot



                    Output with my setup (custom dircolors and custom Solarized terminal theme):



                    gnome-terminal screenshot



                    I got the descriptions from dircolors -p and man dir_colors, and filled in the gaps with my own research.



                    The colors and descriptions are the same from 14.04 to 17.10.






                    share|improve this answer














                    This expands on Karthick87's answer.





                    With the default setup





                    • Uncolored (white): file or non-filename text (e.g. permissions in the output of ls -l)


                    • Bold blue: directory


                    • Bold cyan: symbolic link


                    • Bold green: executable file


                    • Bold red: archive file


                    • Bold magenta: image file, video, graphic, etc. or door or socket


                    • Cyan: audio file


                    • Yellow with black background: pipe (AKA FIFO)


                    • Bold yellow with black background: block device or character device


                    • Bold red with black background: orphan symlink or missing file


                    • Uncolored with red background: set-user-ID file


                    • Black with yellow background: set-group-ID file


                    • Black with red background: file with capability


                    • White with blue background: sticky directory


                    • Blue with green background: other-writable directory


                    • Black with green background: sticky and other-writable directory


                    Script to show colors



                    #!/bin/bash
                    # For LS_COLORS, print type and description in the relevant color.

                    IFS=:
                    for ls_color in $LS_COLORS; do
                    color="${ls_color#*=}"
                    type="${ls_color%=*}"

                    # Add descriptions for named types.
                    case "$type" in
                    bd) type+=" (block device)" ;;
                    ca) type+=" (file with capability)" ;;
                    cd) type+=" (character device)" ;;
                    di) type+=" (directory)" ;;
                    do) type+=" (door)" ;;
                    ex) type+=" (executable file)" ;;
                    fi) type+=" (regular file)" ;;
                    ln) type+=" (symbolic link)" ;;
                    mh) type+=" (multi-hardlink)" ;;
                    mi) type+=" (missing file)" ;;
                    no) type+=" (normal non-filename text)" ;;
                    or) type+=" (orphan symlink)" ;;
                    ow) type+=" (other-writable directory)" ;;
                    pi) type+=" (named pipe, AKA FIFO)" ;;
                    rs) type+=" (reset to no color)" ;;
                    sg) type+=" (set-group-ID)" ;;
                    so) type+=" (socket)" ;;
                    st) type+=" (sticky directory)" ;;
                    su) type+=" (set-user-ID)" ;;
                    tw) type+=" (sticky and other-writable directory)" ;;
                    esac

                    # Separate each color with a newline.
                    if [[ $color_prev ]] && [[ $color != $color_prev ]]; then
                    echo
                    fi

                    printf "e[%sm%se[m " "$color" "$type"

                    # For next loop
                    color_prev="$color"
                    done
                    echo


                    Output with default setup:



                    gnome-terminal screenshot



                    Output with my setup (custom dircolors and custom Solarized terminal theme):



                    gnome-terminal screenshot



                    I got the descriptions from dircolors -p and man dir_colors, and filled in the gaps with my own research.



                    The colors and descriptions are the same from 14.04 to 17.10.







                    share|improve this answer














                    share|improve this answer



                    share|improve this answer








                    edited Jan 30 at 19:12

























                    answered Feb 17 '17 at 21:05









                    wjandrea

                    8,14342258




                    8,14342258












                    • How did you know rs means RESET, mh means MULTIHARDLINK, ca means CAPABILITY etc?
                      – Fredrick Gauss
                      Oct 4 '17 at 8:36










                    • @FredrickGauss As I wrote in the answer, I got descriptions from running dircolors -p.
                      – wjandrea
                      Oct 4 '17 at 16:04










                    • dircolors -p does not say rs is RESET 0 # reset to "normal" color .
                      – Fredrick Gauss
                      Oct 4 '17 at 16:38










                    • @FredrickGauss Not explicitly, but "RESET" is the only one that can be abbreviated as "rs", and the color (0) matches.
                      – wjandrea
                      Oct 4 '17 at 16:45


















                    • How did you know rs means RESET, mh means MULTIHARDLINK, ca means CAPABILITY etc?
                      – Fredrick Gauss
                      Oct 4 '17 at 8:36










                    • @FredrickGauss As I wrote in the answer, I got descriptions from running dircolors -p.
                      – wjandrea
                      Oct 4 '17 at 16:04










                    • dircolors -p does not say rs is RESET 0 # reset to "normal" color .
                      – Fredrick Gauss
                      Oct 4 '17 at 16:38










                    • @FredrickGauss Not explicitly, but "RESET" is the only one that can be abbreviated as "rs", and the color (0) matches.
                      – wjandrea
                      Oct 4 '17 at 16:45
















                    How did you know rs means RESET, mh means MULTIHARDLINK, ca means CAPABILITY etc?
                    – Fredrick Gauss
                    Oct 4 '17 at 8:36




                    How did you know rs means RESET, mh means MULTIHARDLINK, ca means CAPABILITY etc?
                    – Fredrick Gauss
                    Oct 4 '17 at 8:36












                    @FredrickGauss As I wrote in the answer, I got descriptions from running dircolors -p.
                    – wjandrea
                    Oct 4 '17 at 16:04




                    @FredrickGauss As I wrote in the answer, I got descriptions from running dircolors -p.
                    – wjandrea
                    Oct 4 '17 at 16:04












                    dircolors -p does not say rs is RESET 0 # reset to "normal" color .
                    – Fredrick Gauss
                    Oct 4 '17 at 16:38




                    dircolors -p does not say rs is RESET 0 # reset to "normal" color .
                    – Fredrick Gauss
                    Oct 4 '17 at 16:38












                    @FredrickGauss Not explicitly, but "RESET" is the only one that can be abbreviated as "rs", and the color (0) matches.
                    – wjandrea
                    Oct 4 '17 at 16:45




                    @FredrickGauss Not explicitly, but "RESET" is the only one that can be abbreviated as "rs", and the color (0) matches.
                    – wjandrea
                    Oct 4 '17 at 16:45


















                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Ask Ubuntu!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.





                    Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                    Please pay close attention to the following guidance:


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f17299%2fwhat-do-the-different-colors-mean-in-ls%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    數位音樂下載

                    格利澤436b

                    When can things happen in Etherscan, such as the picture below?