Thursday, August 19, 2010

ls colors on Ubuntu

I ls-ed some files today and noticed a few listed with blue backgrounds and white text. I use the --color option to ls because it's pretty, and because the colors provide information that's not always blindingly obvious from regular ls output. Case in point, what did this blue background with white text mean?

It turns out that, at least for Ubuntu 9.10 an 10.04 (the two I tried), you can see a list of the colors that ls uses for various things by typing:

dircolors --print-database

Now, I had a hunch that these files were hardlinks, and sure enough, I saw this line:

HARDLINK 44;37 # regular file with more than one link

And looked up a few lines to see that, yes, 44 is blue and 37 is white. Cool. Just to be extra sure I passed the file names to the stat command and saw the, links: 2 for those files.


James said...

How come this ends up on Planet Emacsen? Where's the Emacs angle?

Bryan said...


Edward O'Conner runs Planet Emacsen:

You'll have to take your concern up with him. I simply mentioned on my Emacs Wiki home page that I blog about emacs from time to time and he decided on his own to add my blog to the feed. I too have noticed the the content on Planet Emacsen isn't 100% emacs related, but sometimes it's fun to see what other emacs users are interested in besides emacs.